Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all 16907 articles
Browse latest View live

Problem using hatbox with React: Id Sequence

$
0
0

When loading my app and going through the messages it seems like the outcome really goes in order of the code instead of the order of the ID's. for instance when the choice of Restaurants is asked, and Activities is chosen then it will still ask what are you craving which is ID 6 but when Activities is selected it supposed to trigger id 15. is there something that I am missing. Even when I click on activities it goes to restaurants. enter image description hereenter image description here


React Navigation modal showing an erroneous gap

$
0
0

I'm using React Navigation 5x's ModalPresentationIOS preset. All my other screens are working fine, but on this one particular screen, I'm seeing a black gap at the top as shown below. I've tried it on a real device as well as the simulator and I'm seeing the same error in both cases:

enter image description here

const AdminStack = () => {
    return (
        <AdminStack.Navigator
            initialRouteName="First"
            screenOptions={{
                headerShown: false,
                swipeEnabled: true,
                gestureEnabled: true,
                gestureResponseDistance: {
                    horizontal: width,
                    vertical: height,
                },
                cardOverlayEnabled: true,
                ...TransitionPresets.ModalPresentationIOS,
            }}
            mode="modal"
            headerMode="none">
            <AdminStack.Screen name="First" component={FirstScreen} />
            <AdminStack.Screen name="Second" component={SecondScreen} />
            <AdminStack.Screen name="AddGroup" component={AddGroupScreen} />
        </AdminStack.Navigator>
    )
}

React Native Static Server iOS

$
0
0

I am using native-static-server for my project.

https://github.com/futurepress/react-native-static-server

I have set up the WWW folder as explained in the Read me doc. The issue I am having is that some of my resources are downloading at run time, which needs to be saved under the WWW folder to be accessed via the server. I can download the images just fine but when I try to save the images in the WWW folder I get a permission error. The error only happens on real devices and I cannot replicate it on Simulator.

Not sure where else I can save the or if I can add the server path to another location? I understand the error is due to not being able to add files to Bundle path at run time. Any help would be greatly appreciated. Thanks in advance

app created through expo-cli crashing on ios real device

$
0
0

After I executed 'xattr -cr path/to/your.app' command ,app got installed in simulator. but its crashing in the real device.

crash report:

error: Error Domain=BKSProcessErrorDomain Code=1 
"Unable to bootstrap process with bundleID com.aq.FOGVERSION2"
 UserInfo={
NSLocalizedDescription=Unable to bootstrap process with bundleID com.aq.FOGVERSION2,
 BKSProcessExitReason=0, 
NSLocalizedFailureReason=Failed to start job,
 NSUnderlyingError=0x282299320 
{Error Domain=NSPOSIXErrorDomain Code=3 
"No such process" 
UserInfo={NSLocalizedFailureReason=The process failed to exec, NSLocalizedRecoverySuggestion=Consult /var/log/com.apple.xpc.launchd/launchd.log 
for more information, NSLocalizedDescription=Unable to get valid task name port right for pid 2019}},
 `BSErrorCodeDescription`=bootstrap-failed}

can you help me to fix it?

React Native app purely in Swift

$
0
0

I created my first react native app using the following command.

react-native init PropertyFinder

This created a project for ios in Objective-C. The problem is I don't know Objective-C but I work on Swift.

This gist shows how to link react-components to a swift project. But is there a way to directly create the project in Swift language?

Expo Client Not Getting Installed On Mac?

$
0
0

The below command to install expo client in the official react native documentation fails.

npm install -g expo-cli

The error shown is attached as a screenshot below.

enter image description here

Someone please tell me how to solve this the github issue below they are pointing to has no answers for this.

https://github.com/request/request/issues/3142

its like if someone new tries to develop on expo its not possible ??

file not found

$
0
0

I am Using cocoapods to install react native and react. I just want to use a toast component(https://www.npmjs.com/package/react-native-simple-toast) which does ti have a cocoapods Installation. when i install and and run the app I am getting an error "" file not found error. I have added header search path but still getting this error. 1)error enter image description here

2)react-native-simple-toast xcode project Header search path enter image description here

3) Main project Header search path enter image description here

Callback when App is killed - React Native [duplicate]

$
0
0

Is there a way to execute an action when a React Native app terminates? I know about app states, but I'm looking for a way to call an action when the user swipes to kill the app, not when it's just in the background.

From my understanding, there is no way in doing this within React Native. Is there a way I could do it natively? I only need this functionality for iOS. Thanks a lot!


Green box shown in heatmap , using react-native-maps on iOS simulator

Refresh a screen after state change [Drawer navigator react-native]

$
0
0

I have a DrawerNavigator in StackNavigator. I have implemented the structure to achieve Hamburger menu function. I have a listing home page with a hamburger menu icon. On clicking the icon, I open a menu just like how it is in Amazon, flipkart apps. The menu list is dynamic, I need to refresh the list on state change.

Here is my view hierarchy:

export const DrawerMenu = DrawerNavigator({
    Search: {
        screen: Search,
    },
    SidebarMenuComponent: {
        screen: SidebarMenuComponent,
        navigationOptions: {
            headerTitle: Logo,
        }
    },
  }, {
    contentComponent: SidebarMenuComponent,
    drawerWidth: 250,
    drawerPosition: 'left',
    drawerOpenRoute: 'DrawerOpen',
    drawerCloseRoute: 'DrawerClose',
    drawerToggleRoute: 'DrawerToggle',
  });

const RootStack = StackNavigator({ 

    Search: {
        screen: DrawerMenu,
        navigationOptions: {
            headerTitle: Logo,
        }
    },

    ThankYou: {
        screen: ThankYou,
        navigationOptions: {
            headerTitle: 'ThankYou',
            gesturesEnabled: false,
        }
    },
  });

I am not able to reload it. So my question here is, how can we force to reload the list for this situation? Any help would be appreciated.

Thank you.

How can I iterate through a props and increment the values inside the props?

$
0
0

I am trying to increment the values of the props whenever an option is clicked depending on which one I click on a mobile application. Each click takes me to the next page and each page has a list of values for example:

question: 'Who won?',
answers:[
            {
                answerId: 1,
                answerText: 'Blue Team',
                scores:[
                    {
                        john: 0,
                        mary: 1,
                        james: 1,
                        sarah: 0,
                    }
                ],
            },
            {
                answerId: 2,
                answerText: 'Red Team',
                scores:[
                    {
                        john: 1,
                        mary: 0,
                        james: 0,
                        sarah: 1,
                    }
            ],
}

If someone would click on Blue Team we would then add the scores for that answer and make the array keeping the scores have the following values:

{
john: 0,
mary: 1,
james: 1,
sarah: 0,
}

This is a snippet of the code that I am using for this

THE FUNCTION TO ADD PROPS


AddAnswerScoresFunction=(props)=>{
    console.log(props);
    // Sum props every time

    sum = props.reduce((a, b)=>{
      for(let k in props.reduce(b)){
        console.log("k is ", k);
        if(b.hasOwnProperty(k)){
           a[k] =(a[k] || 0) + b[k];


          console.log(a[k]);

        }
      }
    },{});

THE BUTTON ON WHICH WE CALL THE FUNCTION

<Text key={i} style={styles.answer} onPress={() => {this.AddAnswerScoresFunction(unique.scores); Vibration.vibrate(500); this.swiper.swipeLeft()}}>{unique.answerText}</Text>


Why I got error message custom font, react native?

$
0
0

I have been desperate for 2 days. I am trying to use custom fonts in my React Native application. I have followed many tutorials, but nothing works.

I have: - import my fonts into the "root/assets/fonts" folder (image 1) enter image description here

  • create a react-native.config.js file (image 2) enter image description here

  • run "react-native link"

  • I also checked that the name of the font was correct.

But I still get this error message:

fontFamily "Gilroy-Regular" is not a system font and has not been loaded through Font.loadAsync.
- If you intended to use a system font, make sure you typed the name correctly and that it is supported by your device operating system.
- If this is a custom font, be sure to load it with Font.loadAsync.

Amazing fact: when I build the app on xcode directly, I don't get an error message and the fonts are well used.

This error occurs when I build with expo.

Thank you a lot for your help..

How to enter barcode manually to fetch the data in react-native?

$
0
0

I'm using react-native-camera to scan the barcode of type code128 only which is working fine. Now, the app scans the barcode and on successful scanning navigates to a new page displaying the type of barcode and the details from the barcode. I also want to type the barcode number manually in a textinput and do the same in case scanning fails. How do I do that ?

How to change value of input react native

$
0
0

Sorry I am new to React Native, and want to know how to change current input value?

As in my case, if I enter a new word directly into input the previous word or the previous value in the value will continue to appear without changing or replacing the new one.

Keyboard keeps closing after user taps on input

$
0
0

The problems =>https://drive.google.com/open?id=1KwBWMVsj-0PFzt9cLfLuZ9cTvkqjIob8

This is my code

export default function TextInp(props) {
  const [ansVal, setAnsVal] = useState(props.data.ans);

  const answer = (ans) => {
    setAnsVal(ans);
    props.answer(ans);
  };

  return (
    <View style={styles.view}>
      <TextInput
        placeholder={props.placeholder}
        style={props.free ? styles.freeContainer : styles.container}
        onChangeText={(text)=>answer(text)}
        defaultValue={ansVal}
      />
    </View>
  );
}

PS. the TextInput is inside ScrollView. I'm not sure if this is the cause of the problem.


Expo react native app image not work properly on testflight ios

$
0
0

I have an app login page centered on screen. When i test on locally with expo on win server and also tested mac on a simulator it works perfectly but when i do build-ios and put it to appstore and test with testflight it is not working properly.

This code works on android also. What am i doing wrong?

You can check full code on github with master branch : https://github.com/saricabasak/keyholder I also share releated codes below that you can check fast

View that i run expo on locally:

enter image description here

on testflight:

enter image description here

app.json

{
  "expo": {
    "name": "key-holder",
    "slug": "key-holder",
    "privacy": "public",
    "sdkVersion": "35.0.0",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "1.1.0",
    "orientation": "portrait",
    "icon": "./assets/kilit_logo_logo_500x500.png",
    "splash": {
      "image": "./assets/kilit_logo_logo_1000x1000.png",
      "resizeMode": "contain",
      "backgroundColor": "#DAD7C5"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "com.coderals.keyholder",
      "buildNumber": "1.0.0"
    },
    "android": {
      "package": "com.coderals.keyholder",
      "versionCode": 1
    },
    "androidStatusBar": {
      "barStyle": "light-content",
      "backgroundColor": "#334393"
    },
    "description": ""
  }
}

image Code:

import logo from '../../assets/transparentLogo.png';


export default class KeyHolderContainer extends Component {
  render() {
    let renderLogo;
    let renderText;
    if (this.props.isLogin) {
      renderLogo = (
        <Image
          source={logo}
          style={container.logoStyle}
          resizeMode="center"
        />
      );
      renderText = (
        <Text style={container.titleStyle}>
          {translate("KeyHolderWelcome")}
        </Text>
      );
    }

    return (
      <Container style={container.containerStyle}>
        {renderLogo}
        {renderText}
        {this.props.children}
      </Container>
    );
  }
}

styles:

export const container = StyleSheet.create({
  containerStyle: {
    width: "100%",
    height: "100%",
    backgroundColor: getStyle("container.backgroundColor")
  },
  logoStyle: {
    width: "40%",
    height: "40%",
    alignSelf: "center"
  },
  titleStyle: {
    color: getStyle("container.titleColor"),
    fontSize:20,
    fontWeight: "bold",
    alignSelf: "center"
  }
});

the image size : 500 x 500 on asset folder.

OS pod install error. Module glog cannot be installed

$
0
0

I'am trying to upgrade "react-native" from "0.50.4" to "0.55".

When I run pod install, i receive an error

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking for arm-apple-darwin-gcc...  -arch armv7 -isysroot 
checking whether the C compiler works... no
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
/Users/MacBook/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing: Unknown `--is-lightweight' option
Try `/Users/MacBook/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/MacBook/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b':
configure: error: C compiler cannot create executables
See `config.log' for more details


[!] Automatically assigning platform `ios` with version `8.0` on target `quanta_react` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

I am a beginner in react-native and I can not make a pod install in my iOS project. Thank you in advance.

ERR_UNKNOWN_URL_SCHEME on react native webview

$
0
0

I'm developing an app with react-native-webview.

And when I click a link with

<a href="sms:888888&body=Test Message">Click here</a>

I'm receiving error err_unknown_url_scheme.

Thanks

Text doesn't appear react native

$
0
0

I made a component but the text is only appearing on Iphone X and not smaller devices like Iphone 8, not sure if i'm missing something ?

const TextComponent = () => {
    return (
        <SafeAreaView style={{ flex: 1, backgroundColor: 'green' }}>
            <Image
                style={styles.emptyStimageateImage}
                source={require('./pic.png')} />
            <Text style={styles.title}>{title}</Text>
            <Text style={styles.content}>{partOne}</Text>
            <Text style={styles.content}>{partTwo}</Text>
        </SafeAreaView>
    )
}

const styles = StyleSheet.create({
    image: {
        width: wp('100%'),
        height: wp('80%'),
    },
    title: {
        fontSize: 20,
        color: 'red',
        padding: 10,
        fontWeight: 700
    },
    content: {
        fontSize: 700,
        color: 'green',
        padding: 10,
    }
})

export default TextComponent

React native responsive fontsize for app store rejected design

$
0
0

My usage like this

import { scale, verticalScale, moderateScale } from 'react-native-size-matters';
import { ScaledSheet } from 'react-native-size-matters';
import { Dimensions, PixelRatio } from 'react-native';

const {
  width: SCREEN_WIDTH,
  height: SCREEN_HEIGHT,
} = Dimensions.get('window');

// based on iphone 5s's scale
const scale_a = SCREEN_WIDTH / 320;

export function normalize(size) {
  const newSize = size * scale_a
  if (Platform.OS === 'ios') {
    return Math.round(PixelRatio.roundToNearestPixel(newSize))
  } else {
    return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2
  }
}

and styles:

    const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'flex-start',
  },
  text_üst: {
    fontSize: normalize(25),
    fontFamily: 'Raleway-Medium',
    color: '#fff',
    textAlign: 'center',
    marginTop: moderateScale(90)
  },





});
const size_styles = ScaledSheet.create({
  inputLayout_üst: {
    marginTop: moderateScale(80),
    width: '300@s'
  },
  inputLayout: {
    marginTop: moderateScale(20),
    width: '300@s'
  },
  textInput: {
    fontSize: normalize(16),
    fontFamily: 'Raleway-Medium',
    height: '40@vs',
    color: '#fff',
    textAlign: 'center',

  },
  btn: {
    width: '280@s',
    height: '50@vs',
    resizeMode: 'stretch',
  },


});

design:

<Text style={styles.text_üst}>Oturum Aç</Text>
        <TextInputLayout
          style={size_styles.inputLayout_üst}
          checkValid={t => EMAIL_REGEX.test(t)}
          hintColor='#fff'
          errorColor='#fff'
          focusColor='#fff'>
          <TextInput
            onChangeText={(text) => this.setState({ USER_MAIL: text })}
            style={size_styles.textInput}
            placeholder={'Mail Adresiniz'}
            keyboardType={'email-address'}
          />
        </TextInputLayout>

my all screens usage like this but app store rejected my app:

Guideline 4.0 - Design

We noticed that several screens of your app were crowded or laid out in a way that made it difficult to use your app.

Next Steps

To resolve this issue, please revise your app to ensure that the content and controls on the screen are easy to read and interact with.

and this link their screenshots:

https://iosapps-ssl.itunes.apple.com/itunes-assets/Purple123/v4/b7/1f/48/b71f48bb-1078-1bd9-a7d1-70de454b8bdf/attachment-11645481553031869613Screenshot-0327-132119.png?accessKey=1585579631_3522999391296608367_46jnr8G7LHRjFqQ4f7sV%2FeK8yZX7aIj7wWPJUThI0Spzcl%2Fpc0cZEc0qcCxSKlFTCs3pt0yBKKhk7r8AdeFZD21lnabbCgZtzkYUiKDJAsQgH0sEt8ujE1L1vRUvSfWaveMgg1B2kYVx8wz2USakWByJezjgbuR8WQXQ7vv%2Bpioahq7hEsq%2BvON7jV6yRF1tIZiXAxg%2Fpl1ojqylspM%2FEEbjPPV2llxaYPStTJ3rmGg%3D

sorry for bad english.

i changed ios deployment target 9.0 to 11.0 is it solution?

Viewing all 16907 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>