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

Ensure that the application's Info.plist contains a value for CFBundleIdentifier. Print: Entry, ":CFBundleIdentifier", Does Not Exist

$
0
0

I am attempting to build my first iOS app using this repo: https://github.com/pmusaraj/discourse-mobile-single-site-app

When building, I receive an error and cannot move forward. I am an absolute noob who will spend long hours on this, but have no idea if I’ve reached a point of failure in the code that I can move beyond with some simple tweaking, or if I must wait for my Issue (opened on the repo) to be resolved by the dev. I assume the dev is busy with other projects and may not have time to help.

Perhaps my software is too new for this? Should I try versioning back react-native and XCode? I could downgrade to XCode 9.2 (Dec 2017 to March 2018 version) and react-native to 0.53.0 (January 2018 version).
My machine:
Mac OSX: 10.14.6
react-native-cli: 2.0.1
react-native: 0.58.6
XCode: 10.3 (build 10G8)

Issue: The info.plist file is not playing nicely with the builder. Inside /ios/DiscoSingle/Info.plist, I see CFBundleIdentifier properly defined as:

<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>

This looks correct to me.

Here’s the error when running react-native ios-build:

The following build commands failed:
    Ld /Users/user919021/Desktop/discourse/ios/build/Build/Products/Debug-iphonesimulator/DiscoSingle.app/DiscoSingle normal x86_64
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/DiscoSingle.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DiscoSingle.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist


Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DiscoSingle.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:629:11)
    at Object.execFileSync (child_process.js:647:13)
    at Promise.then (/Users/user919021/Desktop/discourse/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)

React Native build failed: 'React/RCTBridge.h' file not found

$
0
0

I'm trying to build a React Native app with the following file structure:

Kurts-MacBook-Pro-2:lucy-app kurtpeek$ tree -L 1
.
├── README.md
├── __tests__
├── android
├── app.json
├── assets
├── index.js
├── ios
├── node_modules
├── package.json
├── src
└── yarn.lock

The package.json is

{
    "name": "app",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "android": "concurrently 'emulator @Nexus_5X_API_27_x86''yarn android-noavd'",
        "android-noavd": "react-native run-android",
        "android-px": "concurrently 'emulator @Pixel_2_API_27''yarn android-noavd'",
        "android:release": "cross-env ENVFILE=.env.release yarn run android",
        "android:staging": "cross-env ENVFILE=.env.staging yarn run android",
        "build:android:dev": "cross-env ENVFILE=.env ./android/gradlew assembleRelease -p ./android/",
        "build:android:release": "cross-env ENVFILE=.env.release ./android/gradlew assembleRelease -p ./android/",
        "build:android:staging": "cross-env ENVFILE=.env.staging ./android/gradlew assembleRelease -p ./android/",
        "clean": "concurrently 'rimraf ./android/build/''rimraf ./ios/build/''rimraf node_modules/''yarn cache clean'",
        "codepush": "yarn codepush:ios; yarn codepush:android",
        "codepush:android": "code-push release-react Lucy-Eng/LucyApp-Android android",
        "codepush:ios": "code-push release-react Lucy-Eng/LucyApp-iOS ios --plistFile ios/LucyApp/Info.plist",
        "codepush:ls:apps": "code-push app ls",
        "codepush:ls:deploys": "echo iOS && code-push deployment ls Lucy-Eng/LucyApp-iOS; echo ANDROID && code-push deployment ls Lucy-Eng/LucyApp-Android",
        "codepush:promote:android": "code-push promote Lucy-Eng/LucyApp-Android Staging Production",
        "codepush:promote:ios": "code-push promote Lucy-Eng/LucyApp-iOS Staging Production",
        "ios": "react-native run-ios --simulator='iPhone 7'",
        "ios8": "react-native run-ios --simulator='iPhone 8'",
        "ios:release": "cross-env ENVFILE=.env.release yarn run ios",
        "ios:staging": "cross-env ENVFILE=.env.staging yarn run ios",
        "iosx": "react-native run-ios --simulator='iPhone X'",
        "lint": "eslint .",
        "log:android": "react-native log-android",
        "log:ios": "react-native log-ios",
        "react-devtools": "react-devtools",
        "start": "./node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "analytics-react-native": "^1.2.0",
        "immutability-helper": "^2.5.0",
        "libphonenumber-js": "^1.1.10",
        "lodash": "^4.17.4",
        "moment": "^2.19.0",
        "moment-timezone": "^0.5.14",
        "prop-types": "^15.6.0",
        "querystring": "^0.2.0",
        "raven-for-redux": "^1.3.0",
        "react": "^16.2.0",
        "react-native": "^0.53.3",
        "react-native-android-keyboard-adjust": "^1.1.1",
        "react-native-code-push": "^5.3.2",
        "react-native-config": "^0.11.5",
        "react-native-country-picker-modal": "^0.5.1",
        "react-native-datepicker": "^1.6.0",
        "react-native-intercom": "^8.0.0",
        "react-native-keyboard-aware-scroll-view": "^0.4.4",
        "react-native-markdown-renderer": "^3.1.0",
        "react-native-material-kit": "git://github.com/xinthink/react-native-material-kit#95b0980",
        "react-native-material-menu": "^0.2.3",
        "react-native-modal": "^4.1.1",
        "react-native-onesignal": "^3.0.6",
        "react-native-phone-input": "^0.2.1",
        "react-native-router-flux": "4.0.0-beta.27",
        "react-native-sentry": "^0.35.3",
        "react-native-smart-splash-screen": "^2.3.5",
        "react-native-snackbar": "^0.4.3",
        "react-native-swiper": "^1.5.13",
        "react-native-vector-icons": "^4.4.0",
        "react-navigation": "^1.5.11",
        "react-redux": "^5.0.6",
        "redux": "^3.7.2",
        "redux-devtools-extension": "^2.13.2",
        "redux-form": "^7.3.0",
        "redux-logger": "^3.0.6",
        "redux-persist": "^4.10.1",
        "redux-thunk": "^2.2.0",
        "reselect": "^3.0.1",
        "validator": "^10.2.0"
    },
    "devDependencies": {
        "babel-core": "^6.26.3",
        "babel-eslint": "^8.0.1",
        "babel-jest": "21.2.0",
        "babel-preset-react-native": "4.0.0",
        "code-push-cli": "^2.1.6",
        "concurrently": "^3.5.1",
        "cross-env": "^5.1.4",
        "enzyme": "^3.1.1",
        "enzyme-adapter-react-16": "^1.0.4",
        "eslint": "^4.8.0",
        "eslint-config-airbnb": "^15.1.0",
        "eslint-import-resolver-reactnative": "^1.0.2",
        "eslint-plugin-import": "^2.7.0",
        "eslint-plugin-jsx-a11y": "^5.1.1",
        "eslint-plugin-react": "^7.4.0",
        "eslint-plugin-react-native": "^3.1.0",
        "jest": "21.2.1",
        "react-devtools": "^3.1.0",
        "react-dom": "^16.0.0",
        "react-test-renderer": "16.0.0-beta.5",
        "rimraf": "^2.6.2"
    },
    "jest": {
        "preset": "react-native",
        "setupTestFrameworkScriptFile": "<rootDir>src/test-config/enzyme-config.js"
    },
    "rnpm": {
        "assets": [
            "./assets/fonts/"
        ]
    }
}

and there is an ios/Podfile like so:

target 'LucyApp' do
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'BatchedBridge',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # needed for debugging
    # 'RCTBridge',
    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  # Third party deps podspec link
  pod 'Intercom'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  pod 'SentryReactNative', :path => '../node_modules/react-native-sentry'

  # Add new pods below this line

end

When I try to build this app in Xcode, I get an import error from SentryReactNative:

enter image description here

Similarly, when I try to run the simulator using yarn ios, I get the following error:

In file included from /Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native-sentry/ios/RNSentry.m:1:
In file included from /Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native-sentry/ios/RNSentry.h:4:
/Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native/React/Base/RCTBridge.h:12:9: fatal error: 'React/RCTBridgeDelegate.h' file not found
#import <React/RCTBridgeDelegate.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~



** BUILD FAILED **


The following commands produced analyzer issues:

    Analyze Base/RCTModuleMethod.mm normal x86_64
(1 command with analyzer issues)

The following build commands failed:
    CompileC /Users/kurtpeek/Documents/Dev/lucy/lucy-app/ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/SentryReactNative.build/Objects-normal/x86_64/RNSentryEventEmitter.o /Users/kurtpeek/Documents/Dev/lucy/lucy-app/node_modules/react-native-sentry/ios/RNSentryEventEmitter.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/LucyApp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/LucyApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Following https://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies, I thought at first that I might need to add 'RCTBridge' to the subspecs of 'React', which is the reason for the commented-out line in the Podfile. However, if I uncomment that line and try to pod install, I get a "CocoaPods could not find compatible versions" error:

enter image description here

How can I update the imports to make the app build?

Issue installing react-native-firebase on iOS

$
0
0

I'm attempting to install react-native-firebase on an iOS project. I've followed all instructions but keep having issue

I get the following error:

enter image description here

However, I'm able to import <Firebase.h> from the AppDelegate.m file

I've tried different way to troubleshoot:

  • pod update
  • Uncommented platform :ios, '9.0'
  • Cleaned project
  • Reinstalled everything
  • Added Header Search Paths in Build Settings with: $(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase in recursive

enter image description here

enter image description here

... I'm not sure what is left to try!

This is the dependencies downloaded by Pod:

Using Firebase (5.1.0)
Using FirebaseAnalytics (5.0.1)
Using FirebaseCore (5.0.2)
Using FirebaseInstanceID (3.0.0)
Using GoogleToolboxForMac (2.1.4)

Any idea what else could cause this problem?

Thanks

Apple's UIWebView deprecation warning can be caused by a binary file?

$
0
0

I was checking our dependencies for libraries which using the deprecated UIWebView since we getting this warning from Apple that The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020.

So I find this binary file : react-native-gesture-handler/ios/build/RNGestureHandler/Index/DataStore/v5/records/EJ/UIWebView.h-17DCX353XRLEJ

which is for react-native-gesture-handler library, I didn't find any reference to UIWebView in source-code of the package though, as far as I know, Webview has been removed a year ago from this repo.

So I was wondering if this binary file in any way can be the cause of the Warning we are getting?

react-native-ffmpeg: Native module cannot be null (ios) and null is not an object (evaluating 'RNFFmpegModule.enableLogEvents') (android)

$
0
0

I have a basic expo project that I've eject as expokit, and proceeded to run expo install react-native-ffmpeg. When then running expo start I was greeted with Native module cannot be null on my iOS device and null is not an object (evaluating 'RNFFmpegModule.enableLogEvents').

After that, I re-read the react-native-ffmpeg documentation and added pod 'react-native-ffmpeg', :podspec => '../node_modules/react-native-ffmpeg/ios/react-native-ffmpeg.podspec' to my ios/Podfile and ran pod install. Still no luck.

After that, I deleted the node_modules folder and yarn.lock file, re-ran yarn, went into the ios directory, deleted the Pods folder and Podfile.lock file and re-ran pod install and still had no luck!

The error is less than helpful. Any ideas where to look?

How to support WebP images in react native?

$
0
0

I have to show .WebP image extension images in my react-native app. I'm running on iOS and it's not displaying any image. I googled and found some information saying that webP images won't support on iOS and need to use a library or have to write an extension to support that. I used this react-native library to support webP. Still, I'm not getting. Can someone please advice on this? How to do that?

Note: Please don't mark this as a duplicate. I already checked StackOverflow and didn't find the answer. The issue might similar to webp images problem-stackoverflow

React native and onesignal notification problem

$
0
0

Hi firstly I learning react-native and I use onesignal for notification everything awesome but sometimes iphone 6s hasnt token one signal error is 'Apns Delegate Never Fired' but 6 plus alwasy has a token and background notification very nice. If the application is open while sending a notification, the notification does not occur above. It occurs on a dialog screen.Like this

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#import "AppDelegate.h"

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

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"doyurunbenicomproje"
                                            initialProperties:nil];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end

react native firebase save fcm data only when app is died or closed (IOS)

$
0
0

I'm using react-native-firebase for getting new notification

  • I would like to send from fcm data-only message, but i can't save this data when IOS app is closed or in background.

  • For android the solution is 'Headless JS', so if someone know any solution like Headless JS for IOS it's will be helpful.

https://rnfirebase.io/docs/v5.x.x/messaging/introduction

  • I was looking for IOS background services but all of them working every some minutes and i need to be a real time app

How to import SQLite data to SQLite file via React Native iOS/Android offline app?

$
0
0

How to import/merge SQLite data to existing SQLite via React Native app iOS/Android?

For example:

  • I go to settings via the app.
  • Press import.
  • Select SQLite, file from device.

I have attached a screenshot.

React Native: Unable to import React headers after updating to 0.60

$
0
0

After updating to React Native 0.60 the header linking does no longer work.

I'm having problems linking from the React library during build:

/Users/User/Developer/Project/node_modules/react-native-image-resizer/ios/RCTImageResizer/RCTImageResizer.m:12:9: fatal error: 'React/RCTImageLoader.h' file not found
#import <React/RCTImageLoader.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~

What changed in 0.60:

  • The file RCTImageLoader.h is now at /node_modules/react-native/React/CoreModules.
  • The file React.xcodeproj that contained these headers is no longer present

React Native folder

Create react native module and use it in application

$
0
0

I want to create react-native module for iOS and Android and use it in an application.

I want to use it like a local module, not uploaded to npm.

When i follow the steps described in the official documentation i always have those error on the import of my module into App.js file :

import MyModule from 'react-test-module';

Could not find a declaration file for module 'react-test-module'. '/Users/dbellerose/Path/to/My/Module/react-test-module/index.js' implicitly has an 'any' type. Try npm install @types/react-test-modulet if it exists or add a new declaration (.d.ts) file containing `declare module 'react-test-module';

When i run the iOS application :

Unable to resolve module react-test-module from /Users/Path/To/My/App/App.js: Module react-test-module does not exist in the Haste module map.

The message give me some tips to solve the problem, but it does not work.

To resolve try the following: 1. Clear watchman watches: watchman watch-del-all. 2. Delete the node_modules folder: rm -rf node_modules && npm install. 3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache. 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.

So what do you know what is the good process to create a module and use it in application without uploading the package to npm ?

Best regards,

David

Podfile.lock missing when initial react-native run-ios

$
0
0

I am setting up IOS dev for React Native (0.61) app which has the working android version. What I did was to copy src of components and package.json file after react native environment is setup by following online post (installed xcode command line tool 10.2). But launching run-ios failed:

$ react-native run-ios
error Could not find "Podfile.lock" at /Users/mine/Documents/code/js/emps_fe6/ios/Podfile.lock. Did you run "pod install" in iOS directory?
error Could not find the following native modules: RNCAsyncStorage, RNDeviceInfo, RNGestureHandler, RNKeychain, BVLinearGradient, RNLocalize, RNReanimated, RNVectorIcons, react-native-video. Did you forget to run "pod install" ?
info Found Xcode project "emps_fe6.xcodeproj"
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
error Could not parse the simulator list output. Run CLI with --verbose flag for more details.
Error: Command failed: xcrun simctl list --json devices
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH

    at checkExecSyncError (child_process.js:629:11)
    at Object.execFileSync (child_process.js:647:13)
    at runOnSimulator (/Usersamine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:130:54)
    at Object.runIOS [as func] (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:100:12)
    at Command.handleAction (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:164:23)
    at Command.listener (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:198:13)
    at Command.parseArgs (/Users/amine/Documents/code/js/emps_fe6/node_modules/commander/index.js:651:12)
    at Command.parse (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:474:21)
    at setupAndRun (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:237:24)

Here is the output of react native info:

$ react-native info
info Fetching system and libraries information...
System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-2675QM CPU @ 2.20GHz
    Memory: 194.93 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.17.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
  IDEs:
    Xcode: /undefined - /usr/bin/xcodebuild
  npmPackages:
    react: 16.11.0 => 16.11.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Here is the package.json:

"dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "moment": "^2.24.0",
    "react": "16.11.0",
    "react-native": "0.61.2",
    "react-native-cli": "^2.0.1",
    "react-native-confirmation-code-field": "^4.1.0",
    "react-native-device-info": "^4.0.1",
    "react-native-elements": "^1.2.6",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-gifted-chat": "^0.11.3",
    "react-native-keychain": "^4.0.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^1.3.1",
    "react-native-modal": "^11.4.0",
    "react-native-modal-datetime-picker": "^7.6.0",
    "react-native-reanimated": "^1.3.0",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-video": "^5.0.2",
    "react-navigation": "^4.0.10",
    "react-navigation-stack": "^1.10.2",
    "react-navigation-tabs": "^2.5.6",
    "simctl": "^2.0.0",
    "socket.io-client": "2.1.1",
    "xcode": "^2.0.0"
  },

In the error message, there mentioned quite a few modules which are missing. But those modules have been installed as it shows in the package.json. I am not sure about what the error message means. Also I installed the simctl but scrum simctl still can not find it. I am using VS Code as IDE.

UPDATE:

created an empty Podfile.lock under /ios, the error becomes when run-ios:

error Cannot read property 'SPEC CHECKSUMS' of undefined. Run CLI with --verbose flag for more details.
TypeError: Cannot read property 'SPEC CHECKSUMS' of undefined
    at getDependenciesFromPodfileLock (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/link-pods/getDependenciesFromPodfileLock.js:63:58)
    at warnAboutPodInstall (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/link/warnAboutPodInstall.js:43:67)
    at Object.runIOS [as func] (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:80:36)
    at Command.handleAction (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:164:23)
    at Command.listener (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:198:13)
    at Command.parseArgs (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:651:12)
    at Command.parse (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:474:21)
    at setupAndRun (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:237:24)
    at Object.run (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:184:11)

APNS device token not set before retrieving FCM Token for Sender ID - React Native Firebase

$
0
0

I have been following this tutorial to set-up Remote Push notifications on my react-native application using react-native-firebase Version 5.2.0. After I configured everything and ran the application I get an error as:

APNS device token not set before retrieving FCM Token for Sender ID ''. Notifications to this FCM Token will not be delievered over APNS. Be sure to re-retrieve the FCM token once the APNS token is set.

Been trying to figure out how to solve this issue but wasn't quite successful. Running on react-native : 0.61.2, react-native-firebase: 5.2.0

Following is my AppDelegate.m

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <RNCPushNotificationIOS.h>
#import <UserNotifications/UserNotifications.h>
#import <Firebase.h>

@import Firebase;
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"helloworld"
                                            initialProperties:nil];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  // define UNUserNotificationCenter
  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
  center.delegate = self;

  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
  [RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
  [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
  [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for the localNotification event.
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
  [RNCPushNotificationIOS didReceiveLocalNotification:notification];
}

//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
  NSLog(@"User Info : %@",notification.request.content.userInfo);
  completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);
}


@end

and token retrieval on my App.js:

const messaging = firebase.messaging();

messaging.hasPermission()
  .then((enabled) => {
    if (enabled) {
      messaging.getToken()
        .then(token => { console.log("+++++ TOKEN ++++++" + token) })
        .catch(error => { console.log(" +++++ ERROR GT +++++ " + error) })
    } else {
      messaging.requestPermission()
        .then(() => { console.log("+++ PERMISSION REQUESTED +++++") })
        .catch(error => { console.log(" +++++ ERROR RP ++++ " + error) })
    }

  })
  .catch(error => { console.log(" +++++ ERROR +++++ " + error) });

Any help would be much appreciated! Thanks!

How to properly highlight text in React Native?

$
0
0

I would like to highlight a multiline text in a React Native app by changing the text's background color. The problem is that the background color changes in the whole text area, not just under the words.

class Example extends Component {
  render() {
    const text = '...';

    return (
      <View style={styles.textContainer}>
        <Text style={styles.textStyle}>
          {text}
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  textContainer: {
    flexDirection: 'row',
    flexWrap: 'wrap',
    width: 200,
  },
  textStyle: {
    backgroundColor: 'red',
  },
});

The code above results in something that looks like this: current output

But I would like it to look like this: expected output

I can get that result by splitting the text and adding the background color to the individual words:

class Example extends Component {
  render() {
    const text = '...';

    const brokenText = text.split('').map(word => (
      <Text style={styles.textStyle}>{word} </Text>
    ));

    return (
      <View style={styles.textContainer}>
        {brokenText}
      </View>
    );
  }
}

But splitting the text into individual words doesn't seem like the best solution, and has a huge performance cost. Is there any cleaner way to do it?

Dynamic libraries not linked after updating to React Native 0.60+

$
0
0

After updating to React Native 0.61.5 I am having problems linking libraries that can be linked only dynamically (@react-native-mapbox-gl/maps).

The solution would normally be to enable dynamic libraries in the Podfile (setting use_frameworks!). However, as result this makes all libraries dynamic and causes problems with libraries that can only be linked statically (react-native-firebase).

Is there any solution that would satisfy these conflicting requirements?

When use_frameworks! is set, this error gets thrown at runtime:

dyld: Library not loaded: @rpath/MapboxMobileEvents.framework/MapboxMobileEvents
  Referenced from: /private/var/containers/Bundle/Application/4A4F5BC3-2A1D-4949-9423-71EF7EFE79FD/ImmoWert2Go.app/Frameworks/Mapbox.framework/Mapbox
  Reason: image not found

When use_frameworks! is not set, pod install throws this error:

[!] The 'Pods-ImmoWert2Go' target has transitive dependencies that include statically linked binaries: (FirebaseCore, FirebaseCoreDiagnostics, GoogleDataTransportCCTSupport, GoogleDataTransport, and FirebaseInstanceID)

Exiting because upload-symbols was run in validation mode

$
0
0

Im trying to add Fabric to my xcode project. I've done so succesfully in the past but now facing issues with a react-native project. Having looked around, i've tried pretty much all combinations suggested out there. My setup looks like so:

enter image description here

I've also tried the Pods version using "${PODS_ROOT}/Fabric/run" however no matter what i do im unable to proceed from the Add Run Script step.

In attempt to try and debug i've directed the output of what the Fabric command produces to a file. It yields the following:

Running upload-symbols in Build Phase mode Validating build environment for Crashlytics... Validation succeeded. Exiting because upload-symbols was run in validation mode

Any help much appreciated. Im very unsure as to how to take it from here

ADDITIONAL_INFO:

I've reinstalled the Fabric Mac app from scratch, restarted both xcode,fabric app and the whole system in general. Tried building in release mode and have pretty much tried everything here:

Crashlytics in iOS won't proceed past "Build Your Project" in Fabric app

how can we achieve accessibility for the component bottom sheet in react native?

$
0
0

We have implemented bottom sheet for iOS using third party component "reanimated-bottom-sheet" This is not accessible in iOS.

we could get very little help from the documentation (https://reactnative.dev/docs/accessibility)

Anybody has insights on how we can achieve accessibility for the component bottom sheet ?

Page break in html doesn't work as expected when I print the html with Print API in Expo (iOS)

$
0
0

I tried to add page break to an html and print the html using Expo Print API in my Expo app.

<html>
<body>
<h1>Page 1</h1>
<div class="pagebreak"></div>
<h1>Page 2</h1>
<div class="pagebreak"></div>
<h1>Page 3</h1>
<div class="pagebreak"></div>
</body>
<style>
@page print {
    .pagebreak { break-before: page; }
}
@media print {
    .pagebreak { break-before: page; }
}
@page print {
    .pagebreak { page-break-before: always; }
}
@media print {
    .pagebreak { break-before: always; }
}
</style>
</html>

However in iOS, none of these styles work.

enter image description here

But one of them work in android. Keep below style only,

@media print {
    .pagebreak { break-before: page; }
}

then pick android mode in expo snack, then we find the expected page break.

enter image description here

The reproducible example: Expo snack example. I care about iOS mode only, so no need to worry about android or web.

Note: the question is similar to How to avoid page breaks inside content sections in output PDF generated from HTML using Expo.printToFileAsync on iOS but that question does not provide a reproducible example and its description contains some redundant information. That's why I create a new question here.

Navigate from react native view to ios views in a hybrid app

$
0
0

Hi I was wondering if anyone was able to figure out how to navigate from react native view to native ios view in a hybrid app? I can't seem to find any good documentation for this.

React Native - why is my project folder taking up so much space?

$
0
0

I'm working on a react native project for a startup, but lately I have been noticing some perfomance issues running the Xcode simulator. There is not much animation at all, but simple movements like keyboard toggle are running painfully slow. I am running a brand new MacBook Air, and this issue certainly wasn't existent when the project began. My project takes up 1.25GB, with the ios folder taking up 844.3MB. Is this normal for what is right now a small project? Can I delete my ModuleCache.noindex (616.8MB) folder? Give me some ideas.

Thanks!

Viewing all 16571 articles
Browse latest View live


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