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

Push notifications send bird messaging

$
0
0

I am using sendbird library as a messaging client in react-native. I aim to receive push notifications triggered by sendbird in a channel. I did all the configuration from my side by following documentation given by send bird. Even token is also successfully registered by sendbird. But, when I send message in a group channel the other user of the same channel is not receiving it.

Using below line of code to trigger notifications.

Have used react-native-firebase for notifications as sendbird by default use Firebase for triggering notifications.

    groupChannel.setMyPushTriggerOption('default', function(response, error) { if (error) { return; }  // Do something in response to setting });

Firebase not working with React Native after Bundle change on iOS

$
0
0

I created a React Native project, and I linked it to Firebase using RNFirebase.

After a while I decided to change the default iOS bundle id from 'org.reactjs.native.example.appName' to a custom one.

I changed it from xCode General tab and I also found that the PRODUCT_BUNDLE_ID was still the old one in the xproj file, so I changed that too.

I deleted the old app from Firebase and added a new one with the new bundle and replaced the GoogleService-info.plist on xCode. I also enabled debugging logs with -FIRDebugEnabled in xCode.

The logs are fine, but my iOS stats are always 0, what did I wrong?

React-Native Native module cannot be null after adding Webviews

$
0
0

I am trying to add React-Native Webview in my existing iOS app, but getting issue Native Module cannot be null. I have tried lot of solutions from online community but yet not fixed the issue.

'use strict';import React, { Component } from 'react';import { StyleSheet, View, ScrollView, RefreshControl, WebView, Text} from 'react-native';export default class Dashboard extends Component {    render() {        return (<WebView                originWhitelist={['*']}                source={{ html: '<h1>Hello world</h1>' }}            />         );    }}

Error:

Unhandled JS Exception: Requiring module"node_modules/react-native/Libraries/Components/WebView/WebView.ios.js", which threw an exception: Invariant Violation: Native module cannot be Unhandled JS Exception: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

App crash instantly when lauching on Release mode IOS only

$
0
0

i kinda frustated with this.

it is normal when im running on Debug mode even with Simulator or Device.then , i trying to manage it release mode, but it is instantly close wihout giving any error on JS side. it might be on Native code but i dont undertand how to deal with it.

i got logs from xcode > window > device and simulator > phone > view logs > error logs

here's the logs :

Date/Time:           2020-04-28 18:41:59.4120 +0700Launch Time:         2020-04-28 18:41:58.1507 +0700OS Version:          iPhone OS 13.4 (17E255)Release Type:        UserBaseband Version:    4.02.02Report Version:      104Exception Type:  EXC_BAD_ACCESS (SIGBUS)Exception Subtype: KERN_PROTECTION_FAILURE at 0x00000001fe4d01c0VM Region Info: 0x1fe4d01c0 is in 0x1fe4ceff0-0x1fe4d7170;  bytes after start: 4560  bytes before end: 28591      REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL      __DATA_DIRTY           00000001fe4cedb8-00000001fe4ceff0 [   568] rw-/rw- SM=COW  ...em_info.dylib--->  __DATA_DIRTY           00000001fe4ceff0-00000001fe4d7170 [   32K] rw-/rw- SM=COW  ...oreFoundation      __DATA_DIRTY           00000001fe4d7170-00000001fe4d72d0 [   352] rw-/rw- SM=COW  ...ConfigurationTermination Signal: Bus error: 10Termination Reason: Namespace SIGNAL, Code 0xaTerminating Process: exc handler [964]Triggered by Thread:  14Thread 0 name:  Dispatch queue: com.apple.main-threadThread 0:0   libsystem_kernel.dylib          0x00000001b13d1198 mach_msg_trap + 81   libsystem_kernel.dylib          0x00000001b13d060c mach_msg + 722   CoreFoundation                  0x00000001b157b3b4 __CFRunLoopServiceMachPort + 1483   CoreFoundation                  0x00000001b15763e8 __CFRunLoopRun + 11604   CoreFoundation                  0x00000001b1575c34 CFRunLoopRunSpecific + 4245   GraphicsServices                0x00000001bb6bf38c GSEventRunModal + 1606   UIKitCore                       0x00000001b56a822c UIApplicationMain + 19327   Yogya                           0x000000010052c660 main + 18016 (__hidden#96_:14)8   libdyld.dylib                   0x00000001b13fd800 start + 4Thread 1:0   libsystem_pthread.dylib         0x00000001b1317738 start_wqthread + 0Thread 2:0   libsystem_pthread.dylib         0x00000001b1317738 start_wqthread + 0Thread 3:0   libsystem_pthread.dylib         0x00000001b1317738 start_wqthread + 0Thread 4 name:  Dispatch queue: com.apple.network.connectionsThread 4:0   libnetwork.dylib                0x00000001b3b898d0 -[NWConcrete_nw_address_endpoint type] + 01   libnetwork.dylib                0x00000001b3b95be0 nw_endpoint_get_address + 842   libnetwork.dylib                0x00000001b39bce28 nw_path_create_necp_parameters + 41443   libnetwork.dylib                0x00000001b3bd140c nw_path_evaluator_evaluate + 3244   libnetwork.dylib                0x00000001b3bd0fe0 nw_path_create_evaluator_for_endpoint + 7805   libnetwork.dylib                0x00000001b39e2d3c nw_association_activate + 1406   libnetwork.dylib                0x00000001b39e2248 nw_association_register + 2407   libnetwork.dylib                0x00000001b38ff724 nw_endpoint_handler_initialize_association + 2368   libnetwork.dylib                0x00000001b3908c48 nw_endpoint_handler_start + 11449   libnetwork.dylib                0x00000001b3af4768 nw_endpoint_resolver_start_next_child + 365610  libdispatch.dylib               0x00000001b12c3524 _dispatch_client_callout + 1611  libdispatch.dylib               0x00000001b126be98 _dispatch_continuation_pop$VARIANT$mp + 41212  libdispatch.dylib               0x00000001b127c430 _dispatch_source_invoke$VARIANT$mp + 127613  libdispatch.dylib               0x00000001b1271370 _dispatch_workloop_invoke$VARIANT$mp + 161214  libdispatch.dylib               0x00000001b127978c _dispatch_workloop_worker_thread + 58815  libsystem_pthread.dylib         0x00000001b1314b74 _pthread_wqthread + 27216  libsystem_pthread.dylib         0x00000001b1317740 start_wqthread + 8Thread 5:0   libsystem_pthread.dylib         0x00000001b1317738 start_wqthread + 0Thread 6:0   libsystem_pthread.dylib         0x00000001b1317738 start_wqthread + 0Thread 7:0   libsystem_pthread.dylib         0x00000001b1317738 start_wqthread + 0Thread 8 name:  com.apple.uikit.eventfetch-threadThread 8:

unfortunattely , i cannot read any of error there, because i just code on JS side, not native one. someone maybe can help me with this

Xcode 11.0 build get error - Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]

$
0
0

On every build in Xcode i get this error. How can i fix it?

I found this commit https://github.com/facebook/react-native/pull/25146/commits/61b8b9e69d8609fecaaaa7d2c9e32808bc5e98cb which should fix it but nothing happened.

static BOOL RCTParseUnused(const char **input){ return RCTReadString(input, "__unused") ||     RCTReadString(input, "__attribute__((__unused__))") ||     RCTReadString(input, "__attribute__((unused))");}

I have still this error

enter image description here

Can you help me fix it please?


I looked in node_modules and i already have this line

static BOOL RCTParseUnused(const char **input){  return RCTReadString(input, "__unused") ||         RCTReadString(input, "__attribute__((__unused__))") ||         RCTReadString(input, "__attribute__((unused))");}

Do you have another advice please?

Screen Recording with Audio in React Native or Flutter

$
0
0

I am new to React Native and flutter, Is there any module available or any tutorial from where I could learn and build the Screen recording with audio for both iOS and Android.

What is the right mobile framework for a dating app?

$
0
0

I am in the early stages of building a Tinder-like dating app, what will have a certain edge that is not related to this question. I am thinking about using Firestore/Firebase as the backend, and I am trying to decide if the app needs to be coded in native for IOS and Android, or if I can have is coded in React Native.

Every discussion I read, has a first comment saying “that depends on the budget and on the app”, so let’s start there. I CAN afford to have it made in two native versions – if it is needed. The question is, IF it is needed. The Tinder app is coded in two native versions, but I am having a hard time understanding exactly what I would “lose” by using React Native.

Would it look and feel the same? The main features of the app is setting up a profile, setting up a gallery, swiping yes or no on profiles and being able to chat with matches. That is the app in a nutshell. I read that things like push messages are not an option in React Native, but is push messages all I am “giving up” in this if I choose React Native? Or is there something more?

Bridge is not set. This is probably because you've explicitly synthesized the bridge in CodePush, even though it's inherited from RCTEventEmitter

$
0
0

The error I got is this:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: CodePushDownloadProgress with body: {    receivedBytes = 1965637;    totalBytes = 1965637;}. Bridge is not set. This is probably because you've explicitly synthesized the bridge in CodePush, even though it's inherited from RCTEventEmitter.'

This is how I wrap a React component:

export default CodePush(    {        updateDialog: false,        checkFrequency: CodePush.CheckFrequency.ON_APP_RESUME,        installMode: CodePush.InstallMode.ON_NEXT_RESTART    },)(App);

Anyone know how to fix ?


react-native run-ios Build Fail: CompileC RCTBaseTextInputView.o

$
0
0

How to fix this build failure in ios?I'm using Xcode Version 9.2Mac OS Sierra

What is RCTBaseTextInputView?

CompileC /Users/bliss/Library/Developer/Xcode/DerivedData/RNJyotish-fjjxyvwbhqivjwbnwwqhmqzgfazq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTText.build/Objects-normal/x86_64/RCTBaseTextInputView.o /Users/bliss/Documents/Coder/ReactNative/RNCLI/BITBUCKET/rnjyotish/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler

How to reproduce iOS 11 maps bottom sheet with React Native

$
0
0

Can anyone tell me how I can mimic the bottom sheet in the new maps app in iOS 11?

In android you can use a "BottomSheet", which mimics this behaviour, but I could not find anything like that for iOS.

Is that a simple scroll view with a content inset? So that the search bar is at the bottom?

I am fairly new to iOS programming so if someone could help me creating this layout that would be highly appreciated.

This is what I mean by "bottom sheet":

enter image description here

React Native: How to open OS settings in Android and iOS?

$
0
0

I am developing a mobile application using React Native in which I want to open mobile device's settings when user clicks on a specific button.

I have gone through the docs of RN, but still couldn’t find anything that can help me in achieving the same. Can someone guide me on the same, how can that be implemented?

Thanks :)

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

Pass defined language to mapbox navigation class with React Native & Swift

$
0
0

Im trying to create a Mapbox navigation component with React Native. So my question is whats the best way to implement it via the React Native Component? All help is appreciated. Thanks

RN Component

var navDemo = NativeModules.NavDemo; navDemo.renderNaviDemo(          (originLat = this.props.currentLocation.coords.latitude),          (originLon = this.props.currentLocation.coords.longitude),          (originName = "Start"),          (destinationLat = this.state.manoeuvreDetails.geometry            .coordinates[1]),          (destinationLon = this.state.manoeuvreDetails.geometry            .coordinates[0]),          (destinationName = this.state.manoeuvreDetails.name)        );

Swift Class

import Foundationimport UIKitimport MapboxCoreNavigationimport MapboxNavigationimport MapboxDirectionsimport Mapbox@objc(NavDemo)class NavDemo: NSObject {  @objc  func renderNaviDemo(_ originLat: NSNumber, oriLon originLon: NSNumber, oriName originName: NSString, destLat destinationLat: NSNumber, destLon destinationLon: NSNumber, destName destinationName: NSString) {    let origin = Waypoint(coordinate: CLLocationCoordinate2D(latitude: CLLocationDegrees(truncating: originLat), longitude: CLLocationDegrees(truncating: originLon)), name: originName as String)    let destination = Waypoint(coordinate: CLLocationCoordinate2D(latitude: CLLocationDegrees(truncating: destinationLat), longitude: CLLocationDegrees(truncating: destinationLon)), name: destinationName as String)    let options = NavigationRouteOptions(waypoints: [origin, destination])    Directions.shared.calculate(options) { (waypoints, routes, error) in      guard let route = routes?.first else { return }      let navigationService = MapboxNavigationService(route: route, simulating: .never)      let navigationOptions = NavigationOptions(navigationService: navigationService)      let viewController = NavigationViewController(for: route, options: navigationOptions)      let appDelegate = UIApplication.shared.delegate      appDelegate!.window!!.rootViewController!.present(viewController, animated: true, completion: nil)    }  }}

How to develop react native on remote PC on same network?

$
0
0

I have a headless ubuntu server at home along with my Windows PC. I use it to serve my development stuff. I want to work on my first react native project.

But whether or not I use expo or native-cli I can't run the emulator on my Windows PC while the native app is created and held on my headless ubuntu server. I run my IDE and emulators on my windows PC but I host the app on my headless server on the same home network.

But it seems everything needs to be on the same machine for me to run emulators with the app. Is there anyway around this? PS. I only have one Android device and I want to be able to test on multiple.

Invariant Violation: ViewPagerAndroid has been removed from React Native

$
0
0

Invariant Violation: ViewPagerAndroid has been removed from React Native.'react-native-viewpager' instead of 'react-native'

Yeah. This error was opened on many platforms including here, but I have a different situation. I have never used anywhere. ViewPagerAndroid exists only in the index.android.bundle file in my project. Do I need to update this file? How can I update?I have problems on both platforms as android and ios.

As a solution

1 * react-native-swiper update

2 * Deleting ViewPagerAndroid from node_modules \ react-native-swiper \ src \ index.js file (I did not encounter ViewPagerAndroid. I think I have updated this file before)

I tried many similar things, I tried all the solutions I could find on the internet but I couldn't fix this problem

ViewPagerAndroid exists only in the index.android.bundle file in my project. Do I need to update this file? How can I update

enter image description hereenter image description here


Illegal callback invocation from native module for React Native Module using Native SDK Framework with Delegate Pattern

$
0
0

I am currently implementing a third party SDK that uses the delegate pattern to fire callbacks when async functions are completed. This SDK is used to unlock bluetooth doors. Here is a high level view of how the code behaves. The library is for a vendor so I'm just renaming the method but this is exactly how it is written.

RNMYModuleBridge.m

//rndemo RNMyModule.m#import <React/RCTBridgeModule.h>@interface RCT_EXTERN_MODULE(RNMyModule, NSObject)RCT_EXTERN_METHOD(initializeBLESDK:                      resolver:(RCTPromiseResolveBlock)resolve                      rejecter:(RCTPromiseRejectBlock)reject                    )RCT_EXTERN_METHOD(fetchMobileKeys:                    resolver:(RCTPromiseResolveBlock)resolve                    rejecter:(RCTPromiseRejectBlock)reject                )- (dispatch_queue_t)methodQueue{    return dispatch_get_main_queue();}+ (BOOL)requiresMainQueueSetup{    return YES;}@end// end of file

RNMyModule.swift

import BLESDKimport CoreBluetooth@objc(RNMyModule)class RNMyModule: NSObject, BLEManagerDelegate {  // Promise resolvers for JS    var _resolve: RCTPromiseResolveBlock?    var _reject: RCTPromiseRejectBlock?  // EXPOSED REACT NATIVE FUNCTIONS    @objc func initializeBLESDK(_ UUID: String,                        resolver resolve: @escaping RCTPromiseResolveBlock,                        rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {        self._resolve = resolve;        self._reject = reject;        BLEManager.shared().initializeBLESDK(UUID, withDelegate: self);    }    @objc func fetchMobileKeys(_ Empty: String,                        resolver resolve: @escaping RCTPromiseResolveBlock,                        rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {        self._resolve = resolve;        self._reject = reject;        BLEManager.shared().fetchMobileKeys(self)    }    // DELEGATE CALLBACKS    // this method is called after `BLEManager.shared().initializeBLESDK` completes    // and it works just fine in my App.js file    func initializeBLESDKResponse(_ response: String!, status endpointStatus: Bool) {        if (endpointStatus) {            self._resolve?(response)            return        }        self._reject?(false)    }    // this method is called after `BLEManager.shared().fetchMobileKeys(self)` completes    // HOWEVER: Because fetchMobileKeys scans for devices, this function gets called more than     // once by the delegate, each time it completes a scan. The second time this function is     // called, my react native applications throws the error:    // Illegal callback invocation from native module. This callback type only permits a single     // invocation from native code.    func fetchMobileKeysResponse(_ response: String!, status keysStatus: Bool) {        if (!keysStatus) {            return        }        self.resolve?(reponse);    }}

I can't edit the vendor framework as I just get it as a compiled module with a header file to expose the methods that I am using in the above code.

Is there a way to intercept the delegate callback so that I can use the RCTEventEmitter as discussed in this post here: https://medium.com/nycdev/calling-a-callback-multiple-times-in-a-react-native-module-5c3c61f2fca4

How to create view A closed then view B needs to show using react native?

$
0
0

In my scenario, I am creating single page two views. View A and View B, Here, I am maintaining two views A and B in a function call with separate render. View A having close button once its clickable enabled then View A needs to hide and View B needs to render. How to achieve this?

Main RenderRenderMain() {      return (<View>………….</View>        {this.renderViewA()} // Here rendering view A on main view)}View A Function renderViewA() {      return (<Overlay>…………. // Here rendering View A close click to hide View A and show View B</Overlay>)}View B FunctionrenderViewB() {      return (<Overlay>………….</Overlay>)}

React native: TypeError: null is not an object (evaluating 'SplashScreen.preventAutoHide')

$
0
0

My react native app was working just fine before I used expo eject. I ejected it because I now intend to build and release the app to the ios app store. As soon as I attempt to start the ejected app using react-native run-ios after it's been ejected I get the exception below.

Please could someone help to understand what's causing this issue and how to tackle it?

react Native versions as follows:

react-native-cli: 2.0.1react-native: 0.61.5

enter image description here

TypeError: null is not an object (evaluating 'SplashScreen.preventAutoHide')This error is located at:    in AppLoading (at AppLoading.js:52)    in AppLoading (at App.js:464)    in App (at renderApplication.js:40)    in RCTView (at AppContainer.js:101)    in RCTView (at AppContainer.js:119)    in AppContainer (at renderApplication.js:39)preventAutoHide    SplashScreen.js:4:21AppLoading#constructor    AppLoadingNativeWrapper.js:6:8renderRoot    [native code]:0runRootCallback    [native code]:0renderApplication    renderApplication.js:52:52runnables.appKey.run    AppRegistry.js:116:10runApplication    AppRegistry.js:197:26callFunctionReturnFlushedQueue    [native code]:0

ITMS-90809: Deprecated API Usage warning when using react-native-html-to-pdf

$
0
0

When I submit app on app store I am getting following warning:

following notification form the app-store connect: ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of new apps that use UIWebView APIs starting from April 2020.

I tried implementing solution from following link:https://github.com/christopherdro/react-native-html-to-pdf/issues/151#issuecomment-569597226

After implementing this solution warning from app-store goes but I am getting these two issues:

  1. Images from local cache are not shown in PDF
  2. Font from local cache are not shown in PDF

Also, I am not facing above issues on simulator. I tried running build in release mode and on various versions of simulator.

Thanks in advance.

Which one is the right procedure to create the react native app. create-react-native-app MyReactNative or react-native init MyReactNative?

$
0
0

I am new to the React native app. I am integrating my native iOS Framework in the sample react native app. When I try to create a sample app, I saw two option to create and I have added below:

1: npm install -g create-react-native-app:

After installing NodeJS and NPM successfully in my system I have used this command: npm install -g create-react-native-app

For creating the project I have followed this command: create-react-native-app MyReactNative

Ref:https://www.tutorialspoint.com/react_native/react_native_environment_setup.htm

I can able to use”user_framework!” In the pod file and added swift native dependencies, as well as a static library of react native dependencies and I can able to run the app.

2.react-native init MyReactNative :

I have followed this command for creating the project: react-native init MyReactNative

But when I use the ”user_framework!” In the pod file and added swift native dependencies I can not able to run the app. I am getting the dyld: Library not loaded for swift dependencies.

Ref: https://www.smashingmagazine.com/2016/04/the-beauty-of-react-native-building-your-first-ios-app-with-javascript-part-1/

Viewing all 16550 articles
Browse latest View live


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