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

building an existing react native application issue (cocoapods)

$
0
0

I am trying to build a react native application. I am running into the issue bellow:

I am working with existing react native project

Could not find cocoapods-core-1.8.4 in any of the sourcesRun `bundle install` to install missing gems.Could not find cocoapods-core-1.8.4 in any of the sourcesRun `bundle install` to install missing gems.

what code is sh file is:

npm installcd iosbundle exec pod repo updatebundle exec pod installcd ..

I already uninstalled and reinstalled cocoapods

What else can i do?


react native `pod install` can't find module - but it's there

$
0
0

I'm trying to upgrade from react native 0.60 to 0.62 - I finished all the steps and tried to run pod install, but I get the error below that the module couldn't be found. However, when I cmd+click to follow that path, the file opens. I tried removing node_modules and running npm i - no luck.

pod installmodule.js:491    throw err;    ^Error: Cannot find module '.../node_modules/@react-native-community/cli/build/bin.js(node:41332) ExperimentalWarning: The WHATWG Encoding Standard implementation is an experimental API. It should not yet be used in production applications.'    at Function.Module._resolveFilename (module.js:489:15)    at Function.Module._load (module.js:439:25)    at Function.Module.runMain (module.js:609:10)    at startup (bootstrap_node.js:158:16)    at bootstrap_node.js:578:3[!] Invalid `Podfile` file: A JSON text must at least contain two octets!.

React Native mapbox

$
0
0

I’m trying to show user’s location with a pointer in real-time but the problem I have is the documentation isn’t helpful much. I found a way to get users location updated.Please, thank you.

react-native cant run ios device

$
0
0

I try to run react-native app on a ios real device.It works well on simulator or on a device using xcode but I would like to run with command-lineI tried this :

>npm install -g ios-deploy >react-native run-ios --device "My iPhone"

And this is what I get :

info Found Xcode workspace "Project.xcworkspace"info Building (using "xcodebuild -workspace Project.xcworkspace -configuration Debug -scheme Project -destination id=00008020-0001395426EA002E")......................................................................2020-04-06 11:15:02.836 xcodebuild[16724:402803]  DTDeviceKit: deviceType from 00008020-0001395426EA002E was NULL2020-04-06 11:15:02.967 xcodebuild[16724:402797]  DTDeviceKit: deviceType from 00008020-0001395426EA002E was NULLinfo Installing and launching your app on My iPhone

The app appears in my iPhone but doesnt run.

Metro oppens in a new terminal but I get only this :

               ######                ######                            ###     ####        ####     ###                         ##          ###    ###          ##                        ##             ####             ##                        ##             ####             ##                        ##           ##    ##           ##                        ##         ###      ###         ##                         ##  ########################  ##                       ######    ###            ###    ######                ###     ##    ##              ##    ##     ###         ###         ## ###      ####      ### ##         ###     ##           ####      ########      ####           ##   ##             ###     ##########     ###             ##   ##           ####      ########      ####           ##     ###         ## ###      ####      ### ##         ###         ###     ##    ##              ##    ##     ###                ######    ###            ###    ######                       ##  ########################  ##                         ##         ###      ###         ##                        ##           ##    ##           ##                        ##             ####             ##                        ##             ####             ##                        ##          ###    ###          ##                         ###     ####        ####     ###                            ######                ######                                Welcome to React Native!                Learn once, write anywhereTo reload the app press "r"To open developer menu press "d"

And I doesnt get the progress bar that shows on build with XCode.

React Native Launch/Splash Screen best practices?

$
0
0

I hope everyone is safe during these times. I have been working on React-Native for quite some time now and I still seem to be facing issues with the launch and splash screen.

As per my requirements I need to have a launch screen and then a splash screen, the behavior is that if you haven't opened the app yet on your phone it will show you the launch screen and then the splash screen (two separate assets).

I have built two assets with the same dimensions and have used a package called react-native-splash-screen to achieve this behavior but even with the same dimensions for the assets my launch screen and splash screen end up rendering differently.

The package uses .xib files for iOS and I feel like Storyboard would be a better fit for this use case, but even when using storyboard I am having trouble making my asset scale across devices (it could be good for iPhone 11 but not good with iPhone 8 for example), I did use constraints but to be honest even after trying many times I can't seem to get it perfect.

I know launch screens and splash screens are in most apps out there today, but can someone help me or point me in the right direction to implement this with the best practices especially with React-Native?

Thank you very much.

Which editor is best rich text editor with customizable toolbar in react-native

$
0
0

I want to integrate rich text editor in mobile application using react-native for both iOS and android. The editor toolbar must be customizable i.e we can add our custom button on toolbar and perform action on click on that button. If anyone has integrated such editor with custom button please suggest and please provide some example on how to add custom button on editor toolbar. Your help will be appreciated. Please suggest best rich text editors in react-native with cutom button.Thanks in advance.Pooja.

Obfuscate entire React Native app including JavaScript code

$
0
0

How to obfuscate my react-native JS code? I have set the following in my build.gradle file:

release {      minifyEnabled true      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" }

Here is my proguard-rules.pro file (default):

# Add project specific ProGuard rules here.# By default, the flags in this file are appended to flags specified# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt# You can edit the include path and order by changing the proguardFiles# directive in build.gradle.## For more details, see#   http://developer.android.com/guide/developing/tools/proguard.html# Add any project specific keep options here:# If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the JavaScript interface# class:#-keepclassmembers class fqcn.of.javascript.interface.for.webview {#   public *;#}

But still after unzipping the apk I can find my JS components name, variables and url's

How to pass parameter to swift class from react native bridge

$
0
0

I have a react native app and I call a swift class from this app. I use a bridge for that and I want to pass a parameter to init of my Counter class. How can I do that? I am very new on swift and react.

@interface RCT_EXTERN_MODULE(Counter, NSObject)

swift version is 5.0 react native version is 0.62.1


How to pass callback function on a UINativeModule from React Native

$
0
0

I am accessing a lot of Swift functions, in my react native app, thanks to the native bridge module.

But I am stuck with an this issue:I have to call a function on an instance of Swift from React Native with three parameters, 2 String and 1 callback.

My Swift UIView:

// MyView.swiftclass MyView: UIView {  @objc func update(_ count: Int, forCb callback: @escaping RCTResponseSenderBlock) {    if ([some condition]) {      callback["error"]    }  }}
// MyViewManager.swift@objc(MyViewManager)class MyViewManager: RCTViewManager {  override func view() -> UIView! {    return MyView()  }  override static func requiresMainQueueSetup() -> Bool {    return true  }  @objc func updateFromManager(_ node: NSNumber, refCount count: NSNumber, refCb callback: @escaping RCTResponseSenderBlock) {    DispatchQueue.main.async {      let component = self.bridge.uiManager.view(        forReactTag: node      ) as! MyView      component.update(count, refCb: callback)    }  }}

My React Nativebridge Objective C:

// MyViewManager.m#import "React/RCTViewManager.h"@interface RCT_EXTERN_MODULE(MyViewManager, RCTViewManager)  RCT_EXTERN_METHOD(    updateFromManager:(nonnull NSNumber *)node refCount:(NSInteger)count forCb:(RCTResponseSenderBlock)callback  )@end

and then in my JS Code:

// App.js[...]myFunc = () => {  UIManager.dispatchViewManagerCommand(        findNodeHandle(this.ref),        UIManager.MyView.Commands.updateFromManager,        [1993, () => console.log('here is my callback)],      );}[...]

But i have this error:

ExceptionsManager.js:44 Invariant Violation: [215,1,[3614272248328,"<<Function >>"]] is not usable as a native method argument

Obviously, I can't return the callback in JS that way, do you have an idea ?I need an information from my MyView UI Component, in my Js, and I dont know how to pass it without callbcak.

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

React Native: Invalid `Podfile` file: [!] Specifying multiple `post_install` hooks is unsupported

$
0
0

I'm trying to upgrade from react native 0.60 to 0.62 - I finished all the steps and tried to run pod install, but I get the error below that the module couldn't be found. However, when I cmd+click to follow that path, the file opens. I tried removing node_modules and running npm i - no luck.

pod installmodule.js:491    throw err;    ^Error: Cannot find module '.../node_modules/@react-native-community/cli/build/bin.js(node:41332) ExperimentalWarning: The WHATWG Encoding Standard implementation is an experimental API. It should not yet be used in production applications.'    at Function.Module._resolveFilename (module.js:489:15)    at Function.Module._load (module.js:439:25)    at Function.Module.runMain (module.js:609:10)    at startup (bootstrap_node.js:158:16)    at bootstrap_node.js:578:3[!] Invalid `Podfile` file: A JSON text must at least contain two octets!.

Podfile:

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'def add_flipper_pods!  version = '~> 0.33.1'  pod 'FlipperKit', version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug'  pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug'end# Post Install processing for Flipperdef flipper_post_install(installer)  installer.pods_project.targets.each do |target|    if target.name == 'YogaKit'      target.build_configurations.each do |config|        config.build_settings['SWIFT_VERSION'] = '4.1'      end    end  endendtarget 'APP' do  # Pods for APP  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"  pod 'React', :path => '../node_modules/react-native/'  pod 'React-Core', :path => '../node_modules/react-native/'  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'  pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'#  pod 'RNFirebase', :path => '../node_modules/react-native-firebase'  pod 'Firebase/Analytics', '~> 5.20.1'  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'  post_install do |installer_representation|    installer_representation.pods_project.targets.each do |target|        if target.name == "React"            target.remove_from_project        end    endend  target 'APPTests' do    inherit! :complete    # Pods for testing  end  use_native_modules!  # Enables Flipper.  #  # Note that if you have use_frameworks! enabled, Flipper will not work and  # you should disable these next few lines.  add_flipper_pods!  post_install do |installer|    flipper_post_install(installer)  endendtarget 'APP-tvOS' do  # Pods for APP-tvOS  target 'APP-tvOSTests' do    inherit! :search_paths    # Pods for testing  endend

react-native alert error "Attemp to present UIAlertController

$
0
0

In my react-native application i use some alerts to display messages to the user.

On android everything works fine, but in ios i get following error, every time i try to display an alert:

Warning: Attempt to present <UIAlertController: 0x1030fb600> on <RCTModalHostViewController: 0x1021ad720> whose view is not in the window hierarchy!

i call the alert message via:

this.setState({spinner: true}, () => {  eventHandler    .joinEventById(eventCode, qrHash)    .then((response) => {      this.setState({spinner: false}, () => {        Toast.show('Event Registrierung erfolgreich');      });    })    .catch((error) => {      this.setState({spinner: false}, () =>        funcHelper.showAlert('Fehler beim Beitritt', error, null),      );    });});

i found some solutions to fix it but only for native code, not for the react version.

Can someone give me a hint how i cant fix this or whats the reason for this error

Check that WiFi is turned on in a React Native iOS app

$
0
0

Do you know how it is possible to check that WiFi is turned on in a React Native iOS app. Due to the aGPS on iOS devices, the WiFi must be turned on in order for our location sensitive app to be able to work effectively and we want to notify the user in cases it is turned off.

Any idea how to achieve this in a React Native app for iOS?

React-native component's componentDidMount() is not called under NavigatorIOS

$
0
0

I create a component with ListView under the structure: TabBarIOS>NavigatorIOS>ListView. I try to fetch data in componentDidMount(). But it didn't work unless I fetch it in componentWillMount(). Why?

I've put my work here https://github.com/chiakie/MyAwesomeProject
In MotorcycleList.js, componentDidMount() seem to never be called.

Run react-native application on iOS device directly from command line?

$
0
0

Is it possible to run react-native application on an iOS device directly from the command line like we do on simulator with react-native run ios --simulator "iPhone 5s"?


library not found for -lBranch after React Native 0.62 Update

$
0
0

This started happening on a few libraries after the 0.62 and 0.62.1 updates for React Native. Thanks in advance!

Ld Build/Products/Debug-iphonesimulator/******.app/****** normal x86_64    cd /Applications/******/ios    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios8.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk -L/Applications/******/ios/Build/Products/Debug-iphonesimulator -L<Multiple -Lvalues> -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -F/Applications/******/ios/Build/Products/Debug-iphonesimulator -F/Applications/******/ios/Frameworks -F/Users/brotsky/Documents/FacebookSDK -F/Applications/******/ios/GoogleSdk -F/Applications/******/ios/Pods/Crashlytics/iOS -F/Applications/******/ios/Pods/Fabric/iOS -F/Applications/******/ios/Pods/FirebaseAnalytics/Frameworks -F/Applications/******/ios/Pods/GoogleAppMeasurement/Frameworks -F/Applications/******/ios/Pods/Intercom/Intercom -F/Applications/******/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework -F/Applications/******/ios/Frameworks -filelist /Applications/******/ios/Build/Intermediates.noindex/******.build/Debug-iphonesimulator/******.build/Objects-normal/x86_64/******.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Applications/******/ios/Build/Intermediates.noindex/******.build/Debug-iphonesimulator/******.build/Objects-normal/x86_64/******_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -lBranch -lCocoaAsyncSocket -lDoubleConversion -lFBReactNativeSpec -lFBSDKCoreKit -lFBSDKLoginKit -lFBSDKShareKit -lFirebaseCore -lFirebaseCoreDiagnostics -lFirebaseInstanceID -lFlipper -lFlipper-DoubleConversion -lFlipper-Folly -lFlipper-Glog -lFlipper-PeerTalk -lFlipper-RSocket -lFlipperKit -lFolly -lGoogleDataTransport -lGoogleDataTransportCCTSupport -lGoogleUtilities -lPermission-Camera -lPermission-Contacts -lPermission-FaceID -lPermission-LocationWhenInUse -lPermission-MediaLibrary -lPermission-Microphone -lPermission-Notifications -lPermission-PhotoLibrary -lRCTPagedContacts -lRCTTypeSafety -lRNCAsyncStorage -lRNCPushNotificationIOS -lRNDateTimePicker -lRNDeviceInfo -lRNFBAnalytics -lRNFBApp -lRNFBCrashlytics -lRNFastImage -lRNGestureHandler -lRNPermissions -lRNReanimated -lRNSVG -lRNScreens -lRNSentry -lRNShare -lRNVectorIcons -lReact-ART -lReact-Core -lReact-CoreModules -lReact-RCTAnimation -lReact-RCTBlob -lReact-RCTImage -lReact-RCTLinking -lReact-RCTNetwork -lReact-RCTSettings -lReact-RCTText -lReact-RCTVibration -lReact-cxxreact -lReact-jsi -lReact-jsiexecutor -lReact-jsinspector -lReactCommon -lReactNativeDarkMode -lSDWebImage -lSDWebImageWebPCoder -lSentry -lYoga -lYogaKit -lc++ -lcrypto -levent -levent_core -levent_extra -levent_pthreads -lglog -licucore -llibwebp -lnanopb -lreact-native-branch -lreact-native-camera -lreact-native-config -lreact-native-contacts -lreact-native-document-picker -lreact-native-fbsdk -lreact-native-geolocation -lreact-native-image-picker -lreact-native-intercom -lreact-native-netinfo -lreact-native-network-info -lreact-native-onesignal -lreact-native-splash-screen -lreact-native-webview -lsqlite3 -lssl -lstdc++ -lxml2 -lz -framework Accelerate -framework AdSupport -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreTelephony -framework Crashlytics -framework FIRAnalyticsConnector -framework Fabric -framework FirebaseAnalytics -framework Foundation -framework GoogleAppMeasurement -framework ImageIO -framework Intercom -framework JavaScriptCore -framework MobileCoreServices -framework OneSignal -framework Photos -framework QuartzCore -framework Security -framework StoreKit -framework SystemConfiguration -framework UIKit -framework UserNotifications -framework WebKit -framework iAd -weak_framework Accounts -weak_framework AudioToolbox -weak_framework CoreGraphics -weak_framework CoreLocation -weak_framework Foundation -weak_framework QuartzCore -weak_framework Security -weak_framework Social -weak_framework UIKit -ObjC -lc++ -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Applications/******/ios/Build/Intermediates.noindex/******.build/Debug-iphonesimulator/******.build/******.app-Simulated.xcent /Applications/******/ios/Build/Products/Debug-iphonesimulator/react-native-network-info/libreact-native-network-info.a /Applications/******/ios/Build/Products/Debug-iphonesimulator/Branch/libBranch.a /Applications/******/ios/Build/Products/Debug-iphonesimulator/react-native-onesignal/libreact-native-onesignal.a /Applications/******/ios/Build/Products/Debug-iphonesimulator/react-native-config/libreact-native-config.a /Applications/******/ios/Build/Products/Debug-iphonesimulator/RNVectorIcons/libRNVectorIcons.a /Applications/*****/ios/Build/Products/Debug-iphonesimulator/RNPermissions/libRNPermissions.a /Applications/*****/ios/Build/Products/Debug-iphonesimulator/React-ART/libReact-ART.a /Applications/*****/ios/Build/Products/Debug-iphonesimulator/ReactNativeDarkMode/libReactNativeDarkMode.a /Applications/*****/ios/Build/Products/Debug-iphonesimulator/react-native-intercom/libreact-native-intercom.a -framework CoreFoundation /Applications/*****t/ios/Build/Products/Debug-iphonesimulator/FBSDKCoreKit/libFBSDKCoreKit.a -framework CloudKit -framework SystemConfiguration -framework SafariServices -framework AddressBook -framework CoreData -lsqlite3.0 -lz -lPods-****-***** -Xlinker -dependency_info -Xlinker /Applications/******/ios/Build/Intermediates.noindex/****.build/Debug-iphonesimulator/****.build/Objects-normal/x86_64/*****_dependency_info.dat -o /Applications/******/ios/Build/Products/Debug-iphonesimulator/*****.app/****ld: warning: directory not found for option '-L<Multiple'ld: warning: directory not found for option '-Lvalues>'ld: library not found for -lBranchclang: error: linker command failed with exit code 1 (use -v to see invocation)

Expo build fails in CI but builds locally (babel-preset-expo has been ignored because it contains invalid configuration)

$
0
0

Classic case of it works on my machine. I am building two react-native apps. App A and App B. Both of the applications were bootstrapped using expo.

When I run the command to build either app locally expo build:ios they both build. Yet when I attempt to build the applications in gitlab-ci only application B fails to build with the following message:

[23:07:28] warn Package babel-preset-expo has been ignored because it contains invalid configuration. Reason: Cannot find module 'babel-preset-expo/package.json'[23:07:28] Require stack:[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/runServer.js[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/server.js[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/index.js[23:07:28] - /builds/XXX/application-b/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js[23:07:28] - /builds/XXX/application-b/node_modules/react-native/local-cli/cli.js[23:07:28] [23:07:29] Starting Metro Bundler on port 19001.[23:07:29] debug Watch mode is not supported in this environment[23:07:29] debug Checking for a newer version of React Native[23:07:29] debug Current version: 0.61.4[23:07:29] debug No release cache found[23:07:29] debug No release cache found[23:07:29] debug Checking for newer releases on GitHub[23:07:29] debug No release cache found[23:07:30] Publishing to channel 'default'...[23:07:30] debug Saving "6d6386b01438c6ef0acd213d304b5839" to cache[23:07:30] debug No release cache found[23:07:30] debug No release cache found[23:07:30] debug Latest release: 0.60.0[23:07:32] Building iOS bundle[23:07:43] node_modules/expo/AppEntry.js: Cannot find module 'babel-preset-expo' from '/builds/XXX/application-b'[23:07:43] › Closing Expo server[23:07:43] node_modules/expo/AppEntry.js: Cannot find module 'babel-preset-expo' from '/builds/XXX/application-b'[23:07:43] Failed building JavaScript bundle.[23:07:43] ::ffff:127.0.0.1 - - [06/Apr/2020:23:07:43 +0000] "GET /node_modules/expo/AppEntry.bundle?dev=false&minify=true&hot=false&platform=ios HTTP/1.1" 500 - "-""axios/0.19.0"[23:07:43] › Stopping Metro bundler[23:07:43] Packager URL http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?dev=false&minify=true&hot=false&platform=ios returned unexpected code 500. Please open your project in the Expo app and see if there are any errors. Also scroll up and make sure there were no errors or warnings when opening your project.

I have tried having the CI explicitly install the module babel-preset-expo, but that does not fix the issue. My babel.config.js is identical for both apps and looks like this:

module.exports = function(api) {  api.cache(true);  return {    presets: ['babel-preset-expo'],  };};

I have the following lines in my both of my package.json:

"devDependencies": {"@babel/core": "^7.0.0","babel-preset-expo": "^8.0.0"  },

The file in both applications being referenced in the error AppEntry.js is identical as well.

Any feedback or suggestions as to what this could be would be greatly appreciated. Thanks

Touch is not working in landscape orientation of react-native-webview

$
0
0

I am using react-native-webview for loading url in webview. For first load it works fine with both the orientations i.e. landscape and portrait. But when i switch from portrait to landscape and vice versa, touch doesn't work for some area.

Briefly explained

I am testing in iPhone 7 device so, in portrait mode width and height of screen is 375 and 667 respectively. When i switch orientation from portrait to landscape mode width and height of screen become 667 and 375 respectively. Webview width should become 667 from 375 (you can see the style in code, width and height is set to screen width and screen height respectively) and width is taken 667 that is perfect but touch area is not working from 376 to 667.

Here is my code:

const isPortrait = () => {    const dim = Dimensions.get('screen');    console.log('is_Portrait', dim.height >= dim.width);    return dim.height >= dim.width;};export default class App extends Component {    constructor(props) {        super(props);        this.state = {            url: null,            deviceToken: '',            webViewLoaded: false,            key: 1,            orientation: isPortrait() ? 'portrait' : 'landscape'        };        Dimensions.addEventListener('change', () => {                this.setState({                    orientation: isPortrait() ? 'portrait' : 'landscape'                });        });    }render() {        const {url, deviceToken, safeArea, orientation} = this.state;        let screenWidth = Dimensions.get('window').width        let screenHeight = Dimensions.get('window').height        return (<WebView                            style={{width: screenWidth, height: screenHeight, position: 'absolute'}}                            containerStyle={{width: screenWidth, height: screenHeight}}                            onError={({nativeEvent}) => {                                alert('Internet not available, Cross check your internet connectivity and try again')                            }}                            source={{uri: url}}                            />        );    }}

react native config cannot read env file in ios

$
0
0

I have follow the doc: https://github.com/luggit/react-native-config#iosuntil: Availability in Build settings and Info.pliststep 6. create new build phase for the scheme which will generate "tmp.xcconfig" before each build exposing values to Build Settings and Info.plist (this snippet has to be placed after "echo ... > tmp/envfile" if approach explained below is used)

  • I have created schema for my app then in build -> pre-actions. I click add new script and paste the following:echo ".env.staging"> /tmp/envfile"${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/BuildXCConfig.rb""${SRCROOT}/..""${SRCROOT}/tmp.xcconfig"
  • then I go to info.plist and use $(MYENVVAR) to get value from .env file but it could not get any value.Has anyone ever faced it?my package json lock is "react-native-config": "0.11.7"

Happy to see any comments

Set React Native project with iOS Bridge into reusable NPM Module

$
0
0

I have a React Native project (created with react-native init myProject), implementing a Swift Bridge, in order to get UIViews and methods from a Swift Library. I followed this tutorial to achieve this.Everyhing work fines, and I can use this Swift Lib into my React Native views.

But now I would like to convert this RN project into a reusable component, using NPM module.

I have read a lot of tutorials, and I am lost.

I read about react-native-create-library and react-native-create-bridge, but I understood that it is useless for me as I already create my bridge manually...

Can't I just create my npm module from this same project I was working on ?

Sorry for my confused question, thanks for the help!

Viewing all 16907 articles
Browse latest View live


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