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

React-Native TextInput with focus but without keyboard showing

$
0
0

I'm developing an inventory system for my father's company and on of its requisites is to be able to use an external Barcode/QR Code scanner.

I've developed everything using the camera as well, but I really need to use the scanner whithout showing the keyboard.

Do any of you guys know if it's possible? if not, can it be done in any other way?


react native splash screen get 'React/RCTBridgeModule.h' file not found

$
0
0

I started a new react native application using :

react-native init myApplication

I started with splash screen so i used this library react native spalsh screen

I linked the library to generate native code using this command :

react-native link react-native-splash-screen

And i added files using Xcode like this :

  1. In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
  2. Go to node_modules ➜ react-native-splash-screen and add SplashScreen.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libSplashScreen.a to your project's Build Phases ➜ Link Binary With Libraries
  4. To fix 'RNSplashScreen.h' file not found, you have to select your project → Build Settings → Search Paths → Header Search Paths to add: $(SRCROOT)/../node_modules/react-native-splash-screen/ios

I build the app using Xcode in a real Iphone and i get this error in RNSplashScreen.h :

    /**
 * SplashScreen
 * 启动屏
 * from:http://www.devio.org
 * Author:CrazyCodeBoy
 * GitHub:https://github.com/crazycodeboy
 * Email:crazycodeboy@gmail.com
 */
#import <React/RCTBridgeModule.h> // <------'React/RCTBridgeModule.h' file not found
#import <UIKit/UIKit.h>

@interface RNSplashScreen : NSObject<RCTBridgeModule>
+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView;
+ (void)show;
+ (void)hide;
@end

'React/RCTBridgeModule.h' file not found

the Podfile :

    pod 'React', :path => '../node_modules/react-native/'
    pod 'React-Core', :path => '../node_modules/react-native/React'
    ...... # other libaries
    pod 'react-native-splash-screen', :path => '../node_modules/react- 
    native-splash-screen'

AppDelegate.m :

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ....  <------- other code
  [RNSplashScreen show];
  return YES;
}

Metro bundler errors when using module-resolver

$
0
0

I've created a project using expo typescript template. Running on iOS and Android. No web.

I then set up path alias in tsconfig.json as follows:

"paths": {
  "@models/*": ["./src/models/*"],
  "@navigation/*": ["./src/navigation/*"],
  "@services/*": ["./src/services/*"],
  "@components/*": ["./tsx/components/*"],
  "@screens/*": ["./tsx/screens/*"],
  "@assets/*": ["./assets/*"]
}

Correspondingly, I configured babel.config.js as follows:

plugins: [
        [
            'module-resolver',
            {
                root: ['./'],
                alias: {
                    '@models': path.resolve(path.dirname('.'), 'src/models'),
                    '@navigation': path.resolve(path.dirname('.'), 'src/navigation'),
                    '@services': path.resolve(path.dirname('.'), 'src/services'),
                    '@screens': path.resolve(path.dirname('.'), 'tsx/screens'),
                    '@components': path.resolve(path.dirname('.'), 'tsx/components'),
                    '@assets': path.resolve(path.dirname('.'), 'assets'),
                }
            }
        ]
    ]

The above configuration works. App is bundled and runs fine. However the following non-critical errors are emitted during bundle:

transform[stderr]: Could not resolve "/Users/jblues/mobbiz/LOSMobileApp/src/navigation/AppNavigator" in file /Users/jblues/LOSMobileApp/tsx/App.tsx.
transform[stderr]: Could not resolve "/Users/jblues/LOSMobileApp/tsx/components/BottomTabNavigator" in file /Users/jblues/LOSMobileApp/src/navigation/AppNavigator.ts.
transform[stderr]: Could not resolve "/Users/jblues/mobbiz/LOSMobileApp/tsx/screens/Login" in file /Users/jblues/LOSMobileApp/src/navigation/AppNavigator.ts.

. . and so on. Is there something that I can add to my config to prevent these errors?

alarm in react native?

$
0
0

I'm making a reminder app in react native and i'm at the point where i want an alarm (just normal alarm on the phone) When im search on google for this, I just see that people suggest calendar events https://www.npmjs.com/package/react-native-add-calendar-event. I just want a simple alarm that the user can set and then it beeps or making a sound right when its time. I did find DateTimePicker but there is no documentation on how to make set the sound or make it an alarm.

this is what i have now https://github.com/react-native-community/react-native-datetimepicker

Is it even possible to access the alarm on the phone via my app?

What should i do or what is the best solution for an app like this?

React Native PDF Signature

$
0
0

I’m trying to implement a pdf digital signature component for a react-native app.

I am using react-native-pdf for rendering the pdf on the screen and react-native-draggable for dragging the signature on top of the pdf view.

With react-native-draggable I can get the position of the signature on the screen but not related to the position on the pdf document.

Is there a way I can get/calculate the vertical position on the pdf?

I have to take into account different screen sizes, different pdf sizes, and different and variable margins. It looks more or less like this Refer to this image

Any formula/algorithm you can point as help is appreciated.

Dyld Error Message:dyld_sim is not compatible with the loaded process, likely due to architecture mismatch

$
0
0

I am building a react native iOS app.I have to submit simulator build to facebook in order to review my app (my app isn't live yet).

I am using following commands to generate the simulator build.

xcodebuild -arch i386 -sdk iphonesimulator13.2 -workspace Project_Name.xcworkspace -scheme Project_Name

Once I get Build Succeeded message I want to verify the build using command -

2.ios-sim launch /Users/saket/Library/Developer/Xcode/DerivedData/Project_Name-bkjjtovswivrldcaslxqeprbkhxr/Build/Products/Release-iphonesimulator/App.app --devicetypeid iPhone-11

It then starts simulator but my app crashes on start and I get following error in crash report of the simulator.

Crashed Thread:        Unknown
Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY
Termination Reason:    DYLD, [0x9] <unknown>
Dyld Error Message:
  dyld_sim is not compatible with the loaded process, likely due to architecture mismatch
Binary images description not available

Configurations

Xcode version: 11.3.1

Xcode Build version: 11C504

Simulator: iPhone 11

OS: Mac OS X 10.15.2 (19C57)

react-native version: 0.60.5

react native - payment with PayPal v2/orders

$
0
0

I am implementing PayPal in React Native, following the documentation for PayPal Payments v2 API

Here is the step by step of my checkout:

  1. Use https://api.sandbox.paypal.com/v1/oauth2/token to get token.
  2. Use https://api.sandbox.paypal.com/v2/checkout/orders to create an order
  3. Use approve link for clients to accept payment
  4. I set the return_url to be https://www.google.com/. After clients accept the payment, I receive the return_urlhttps://www.google.com/?token=<order_id>&PayerID=<payer_id>

At this point I'm stuck: how can I use the information order_id and payer_id?

ViewPager and GooglePlacesAutocomplete don't work together in React Native under Expo

$
0
0

I have a GooglePlacesAutocomplete component inside a ViewPager component, but apparently they're not working well together for iOS.

It works fine with Android.

In this code, it pretty much loops through a list of components and displays them using ViewPager horizontally.

<View style={styles.container}>
        <ViewPager
          keyboardDismissMode={"on-drag"}
          style={styles.viewPager}
          ref={viewPager => {
            this.viewPager = viewPager
          }}
          onPageSelected={page => {
            this.setState({ currentPage: page.position })
          }}>
          {PAGES.map( (page, index) => this.renderViewPagerPage(page, index))}
        </ViewPager>
</View>

This other code is just importing the component for the Places API with a bunch of styles and flags for it.

{
    return (
      <View>
      <Text  style={styles.header}>Pick Up Location</Text>
      <GooglePlacesAutocomplete
      onPress={() => console.log('pressed')} 
       styles={{  
        container: {
          position: "absolute",
          top: 40,
          width: "100%",
      },
      textInputContainer: {
        flex: 1,
        backgroundColor: "transparent",
        height: 54,
        marginHorizontal: 0,
        borderTopWidth: 0,
        borderBottomWidth: 0,
        paddingBottom: 50,

      },
      textInput: {
        height: 54,
        margin: 0,
        borderRadius: 0,
        paddingTop: 0,
        paddingBottom: 0,
        paddingLeft: 20,
        paddingRight: 20,
        marginTop: 0,
        marginLeft: 0,
        marginRight: 0,
        elevation: 5,
        shadowColor: "#000",
        shadowOpacity: 0.1,
        shadowOffset: { x: 0, y: 0 },
        shadowRadius: 15,
        borderWidth: 1,
        borderColor: "#ddd",
        fontSize: 18,
      },
      listView: {
        borderWidth: 1,
        borderColor: "#ddd",
        backgroundColor: "#fff",
        marginHorizontal: 20,
        elevation: 5,
        shadowColor: "#000",
        shadowOpacity: 0.1,
        shadowOffset: { x: 1, y: 0},
        shadowRadius: 15,
        marginTop: 10,
      },
      description: {
        fontSize: 16
      },
      row: {
        padding: 20,
        height: 58,}
      }}
      keyboardShouldPersistTaps='always'
      placeholder="Placeholder"
      keyboardAppearance={'dark'} // Can be left out for default keyboardAppearance https://facebook.github.io/react-native/docs/textinput.html#keyboardappearance
      placeholderTextColor="#333"
      returnKeyType={'default'}
      onPress={(data, details) => {
        console.log(data['description']);
      }}
      currentLocationLabel="Current location"
      currentLocation={true} // Will add a 'Current location' button at the top of the predefined places list
      query={{
        key: GOOGLE_MAPS_API_KEY,
        language: "en",
        components: 'country:pr'
      }}
      textInputProps={{
        autoCapitalize: "none",
        autoCorrect: false
      }}
      fetchDetails={false}
      enablePoweredByContainer={true}
    />
  </View>   
    );
  }
}

I have a ViewPager which is essentially a type of carousel, in which inside will have an AutoComplete input container using Google's Places API.

It works fine outside of the ViewPager component, but when it's inside of it, I can't click the autocomplete list view that it pops while auto completing the text.


Revenuecat React-Native iPad Purchases.purchasePackage - promise not settling

$
0
0

using

"react": "16.9.0",
"react-native": "0.61.5",
"react-native-purchases": "^3.0.6",

We're having a problem on an 11" iPad running through testflight on iOS version 13.3.1. Everything works on all simulators, and our iPhones and other iPads running on testflight work properly as well.

The problem is that the promise returned by Purchases.purchasePackage is neither resolving nor rejecting - it hangs. After combing thru the native Obj-C code, I've found relevant code in the file Pods/Purchases/RCPurchases.m. The method

- (void)purchaseProduct:(SKProduct *)product withPayment:(SKMutablePayment *)payment withPresentedOfferingIdentifier:(nullable NSString *)presentedOfferingIdentifier completion:(RCPurchaseCompletedBlock)completion

is getting invoked, and the line

[self.storeKitWrapper addPayment:[payment copy]];

is called, but the callback method

- (void)storeKitWrapper:(RCStoreKitWrapper *)storeKitWrapper
     updatedTransaction:(SKPaymentTransaction *)transaction

is never invoked. Could this be an underlying issue with SKPaymentQueue?

Thanks!

How to building React Native App using WebRtc

$
0
0

Thank you for your help in advance.

I want to make a new WebRtc mobile application for video calling using react native, i checked many articles but not getting exact information how to start. Can any person please help me and guide me the path to create an application.

.\gradlew /clean

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Jig\New folder\react-native-demoapp-master\react-native-demoapp-master\node_modules\react-native-webrtc\android\build.gradle' line: 30

  • What went wrong: A problem occurred evaluating project ':WebRTCModule'.

    Could not find method implementation() for arguments [com.facebook.react:react-native:+] on project ':WebRTCModule'.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.903 secs

How to get/set the iOS "preferred language" from a RN app?

$
0
0

We are developing a React Native app supporting three languages. For various reasons, we must have specific language selection logic in the app and a language selector within the app.

In iOS 13 there is a new "Preferred language" selector in the system settings for the app. We would want the in-app language selector to change the preferred language, and conversely that the user could also change their language in the system settings.

How can I read/write the iOS "Preferred language" in a React Native app?

Configurations Facebook Login for iOS - React Native?

$
0
0

I'm using react-native-fbsdk For Facebook Login, I just follow the guide to Configure my app but after building my app I see this error,

enter image description here

I'm trying to clean my build project then re-build/re-install Pods but sadly it does not work for me.

Any help?

what is best image editor module or sdk in react native

$
0
0

I am going to make react native app for image edit. But I don't know which is best module or sdk. Such as crop, zoom in and out, rotate, sticky, brush, text, ... .... I hope your advance.

Is having different iOS bundle ID from android package name bad?

$
0
0

What are the downsides of different android package name and iOS bundle ID in React Native?

I need to test my React Native app (Ejected from Expo as Bare Workflow) on my personal device. How do I build it and deploy on my iPhone?

$
0
0

This is purely for educational purposes, I am not planning to launch it to App Store at all as it is just a project I'm working on for College. I was using Expo managed workflow earlier but had to implement some native libraries, I still need to develop more of the code but since I can't access some third-party library through the Expo iOS app client, I want to be able to see if each features I have implemented work on my personal device.

Is there a way to build the app and install it on my iPhone to test it out? Along with rebuilding again after updating/fixing my codes? I missed the fast refresh feature the Expo app provided but since it is ejected, I am not sure how to test the app while working to finish up the project.


iOS app fails to build in fastlane but works in Xcode

$
0
0

I'm building a React Native app and am using Fastlane to manage my signing, building and deployment. I'm trying to build an ad-hoc package but each time I run the build using Fastlane gym, I get an error message about a missing header file. The build runs fine in Xcode from Product -> Build and I can run the app fine in my local simulators.

The error message I'm seeing is from gymAppDelegate.m:13:9: 'ReactNativeNavigation/ReactNativeNavigation.h' file not found, which I'm aware is associated with the React Native Navigation setup, and have followed the steps to fix it.

Has anyone seen this error before, or have any suggestions on how to get more information about why the Xcode build is working? I've tried scrubbing my build, pods and node_modules directories with no luck. I'm using React Native 0.59.9 and Xcode 11.3.1.

This is what I have in my Fastfile:

match(
  type: "adhoc",
  git_branch: "master",
  git_url: "<my cert repo>",
  app_identifier: ["<main app ID>", "<app extension ID"],
  team_id: "<my team ID>",
  readonly: true,
)
sh('yarn', 'build:ios')
gym(
  workspace: "myApp.xcworkspace",
  scheme: "myApp",
  configuration: "Beta",
  export_method: 'ad-hoc',
  output_directory: "builds",
  output_name: ipaName,
)

FYI, in this case yarn build:ios is an alias for react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --assets-dest ios --platform ios

react-native-google-places-autocomplete not working on React native 0.61

$
0
0

I have added react-native-google-places-autocomplete with yarn in my react-native cli project but it is not working. Here are the issues I am facing at the moment.

  1. the places drop down is not showing up on IOS, however the input text field allows me to enter a place name but the predictions list does not appear

  2. onPress handler is not triggered at all on both IOS and android

  3. The Text Input coming from react-native-google-places-autocomplete does not allow me to enter anything on ANDROID. It is like disabled all the time ( although the focus is set to true)

Note: all google location apis are enabled , google maps api, places api and geocode api are enabled and a valid api key is given.

I tried all possible solutions available including the following:

  1. setting zIndex: 1000 a high value to avoid it being hidden behind some other view

  2. Tried creating new RN App and added only this component to keep the project clean

  3. Regenerating the API and even using another api which works with previous versions of REACT NATIVE.

The logs don't show anything on both Xcode and Android Studio. Here is the code snippet:

<View style = {[{zIndex: 2, backgroundColor: 'white'}]}>
                <GooglePlacesAutocomplete
                    ref = {ref => setSearchTextRef(ref)}
                    placeholder='Search for gym'
                    styles={{
                        container: {backgroundColor: 'transparent'},
                        textInputContainer: styles.viewStyle,
                        textInput: styles.textInputStyle,
                    }}
                    keyboardShouldPersistTaps = {'handled'}
                    listUnderlayColor = {'transparent'}
                    textInputProps = {{
                        onFocus: () => focusInput(),
                        onBlur: () => blurInput(),
                        onChangeText: (text) => onChange(text)
                    }}
                    minLength={1} // minimum length of text to search
                    returnKeyType={'search'}
                    listViewDisplayed={'auto'}   // true/false/undefined
                    fetchDetails={true}
                    renderDescription={row => row.description} // custom description render
                    onPress={(data, details = null) => {
                        let coordinates = details.geometry.location;
                        sendCoordinates(coordinates, {data, details});
                    }}
                    getDefaultValue={() => ''}
                    query={{
                        key: googleAPIKey,
                        language: 'en', // language of the results
                        // types: '(cities)' // default: 'geocode'
                    }}
                    nearbyPlacesAPI='GooglePlacesSearch' // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
                    GooglePlacesSearchQuery={{
                        rankby: 'distance',
                        types: 'gym'
                    }}
                    filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']} 
                    debounce={200}
                />
            </View>

Thank you in advance

iOS 13 React Native Onesignal Device ID is always null on real device

$
0
0

I am learning how to send and receive a push notification from react-native iOS with one signal. But I can't get a device ID from the one signal. It says error.

I did OneSignal.setLogLevel(6, 0). So the console log is below:

VERBOSE: network response (OSRequestRegisterUser): {
errors =   (
"[\"Identifier invalid format.\"]"
);
success = 0;
}

React native version 59 Onesignal version 3.3.2 I have updated one signal to the latest version (3.6.4) but I got lots of error. But the iOS 13 emulator is working fine.

Is anyone have any idea about it?

ExpoKit: "Native Module cannot be null" error after installing expo-in-app-purchase

$
0
0

I'm currently running an Expo app that was recently ejected to ExpoKit. It has been working as expected up until I installed expo-in-app-purchases from https://docs.expo.io/versions/latest/sdk/in-app-purchases like so:

npm i expo-in-app-purchases
cd ios
pod install

I then import the module in one of my app files like so:

import * as InAppPurchases from 'expo-in-app-purchases';

When I try to run the app on the Expo client, I get the following error: Error message

And When I try to build the app on XCode, I get the following build error: "Use of undeclared identifier"

I tried linking the package using react-native link but it did not fix the issue. I also tried removing node_modules and re-installing them along with pod update && pod install, but the issue persists.

Any help is appreciated!

Here are package.json dependencies:

"expo": "^33.0.0",
    "expo-constants": "^5.0.1",
    "expo-font": "^5.0.1",
    "expo-in-app-purchases": "^6.0.0",
    "expo-linear-gradient": "^5.0.1",
    "expokit": "^33.0.4",
    "react": "16.8.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
    "react-native-unimodules": "^0.4.2",
    "react-navigation": "^3.11.1",
    "react-redux": "^7.1.0",
    "redux": "^4.0.4",
    "socket.io-client": "^2.1.1"

Which one should I choose Swift or React Native?

$
0
0

I would like to build a simple TODO mobil app, but I can't choose between Swift and React Native. Now I just want to create an iOS app, maybe later I will create an Android version.

My question is, which one should I use? Which is better and why?

Viewing all 16899 articles
Browse latest View live


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