react-native-text-input-mask: React Native 0.60 not work

Bug

Hello! This component not work is RN 60

Environment info

React native info output:

 // paste it here

Library version: x.x.x

Steps To Reproduce

Describe what you expected to happen:

Reproducible sample code

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 22
  • Comments: 57 (9 by maintainers)

Commits related to this issue

Most upvoted comments

this kind of issues shouldn’t be allowed, it’s poorly edited and it gives no insight whatsoever.

I’m using 0.60.5 on Android and it’s working. No warnings. I’m going to test on iOS later and I’ll try to update this.

In react-native 0.62 I just added this line below to Podfile and ran pod install:

pod 'RNInputMask', :path => '../node_modules/react-native-text-input-mask/ios/InputMask'

And now it works for me 😃

@betoharres updated the readme file in #140 . We need Dummy.swift as on RN 0.60 we cannot use use_frameworks!. But for any one using RN 0.60.1 or greater version no need of Dummy.swift. I have mentioned the instructions in readme file in #140 .

Am currently using the newest version of react native 0.60.5, but am getting the error React/RCTBridge.h file not found

Did not have this error before upgrading.

Some solution that I tried were: https://stackoverflow.com/questions/50453883/react-native-build-failed-react-rctbridge-h-file-not-found/50460552

However, the top solution, when I went into manage scheme. There is no React, and it also says React(missing). There is a React-Core, and I tried using that, however the project still fails

also followed this link getsentry/sentry-react-native#395 (comment) but did not work

@betoharres if you add following two lines in header search path

$(SRCROOT)/../../../ios/Pods/Headers/Public
$(SRCROOT)/../../../ios/Pods/Headers/Public/React-Core

with mode recursive and change the imports in RNTextInputMask.m from

#import <RCTText/RCTBaseTextInputView.h>
#import <RCTText/RCTUITextField.h>

to

#import "RCTBaseTextInputView.h"
#import "RCTUITextField.h"

It will work with RN 0.60.5 with manual integration. Usage with pods through auto linking will not work as currently the swift code or usage of frameworks is not supported in RN 0.60.5. Need to wait for following pull request to be released. https://github.com/facebook/react-native/pull/25619

@waqas19921 when you run pod install do you get this warning: [!] use_native_modules! skipped the react-native dependency 'react-native-text-input-mask'. No podspec file was found.?

@karmil32 I’m using RN 0.61.5, but I followed the instruction “For RN = 0.60.*” and it is working fine for me. No need to use use_frameworks!.

i get:

[!] Unable to find a specification for RNInputMask depended upon by RNTextInputMask

after doing pod install

It works if you link it like this:

pod 'react-native-text-input-mask', :path => '../node_modules/react-native-text-input-mask'
pod 'RNInputMask', :path => '../node_modules/react-native-text-input-mask/ios/InputMask'

Everyone please test following pull request code #140, which includes pods integration. By running yarn add waqas19921/react-native-text-input-mask

It is working fine with RN 0.61.1. Need to verify it with 0.60.*

Now i get error while compiling on iOS.

The 'Pods-AppName' target has transitive dependencies that include static binaries: (/AppPath/ios/Pods/Crashlytics/iOS/Crashlytics.framework and /AppPath/ios/Pods/Fabric/iOS/Fabric.framework)

I know that’s related to Crashlytics but don’t how to fix it.

EDIT: Also tried 0.60.* way but got error: Build/Intermediates.noindex/ArchiveIntermediates/TelematicsB2B/BuildProductsPath/Debug-iphoneos/RNInputMask/RNInputMask.modulemap' not found

Thank you for the PR you made @waqas19921

I’m upgrading from RN 0.59.9 to RN 0.60.5. This last library is currently the show stopper.

In my package.json, I’m pointing to: “react-native-text-input-mask”: “https://github.com/react-native-community/react-native-text-input-mask#abf0e7f

I’m pinning it to the commit that merged your PR since I don’t want bleeding edge master all the time.

yarn install and then run it (tried both via terminal and Xcode) but am not able to get my app working.

Xcode is returning the following on app start:

[error][tid:com.facebook.react.JavaScript] null is not an object (evaluating '_reactNative.NativeModules.RNTextInputMask.mask')

I have InputMask.framework inside Embedded Binaries and Linked Frameworks and Libraries. I also have it in Link Binary With Libraries.

Just to note, before upgrading this setup worked. Any ideas what I may be doing wrong or missed?

----- UPDATE

To overcome the above issue, I had to remove any remaining references to the react native core libraries in Xcode. Since Pods now handles this, it meant that all of those references had to be removed.

There used to be a whole bunch of .xcodeproj files in under the Libraries folder (for example RCTText, RCTAnimation etc). I deleted all of them (remove reference) and left only RNTextInputMask.xcodeproj Screenshot 2019-09-26 at 9 02 38 PM

Also made sure there was nothing in Build Phases -> Link Binary With Libraries except InputMask.framework and libRNTextInputMask.a

Now running react-native run-ios works from the terminal!

Unfortunately, running from Xcode does not.

After this, I then ran into the issue you were facing @k3ithl1m

'React/RCTBridgeDelegate.h' file not found

Really odd that it works from the terminal but not from Xcode GUI.

---- FINAL UPDATE

Ok everything works now.

There were several warnings in yellow after doing pod install that I was ignoring.

[!] The `MyApp [Debug]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-MyApp/Pods-MyApp.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `MyApp [Release]` target overrides the `HEADER_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-MyApp/Pods-MyApp.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `MyAppTests [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-MyAppTests/Pods-MyAppTests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `MyAppTests [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-MyAppTests/Pods-MyAppTests.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `MyAppTests [Release]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-MyAppTests/Pods-MyAppTests.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `MyAppTests [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-MyAppTests/Pods-MyAppTests.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

After listening to the above instructions and adding the $(inherited) flag to each corresponding area from the warnings, rerunning pod install and then building the app, the RCTBridgeDelegate error was gone.

It still failed during the build though. It failed with:

library not found for -lyoga

These lines were added for the sake of react-native-config and was removing yoga. I had to remove the following lines from my podfile:

    targets_to_ignore = %w(React yoga)

    if targets_to_ignore.include? target.name
      target.remove_from_project
    end

Redid the pod install and then test ran it in both Xcode and via terminal.

Finally DONE! Works in the terminal and in Xcode. Crazy long, but hopefully helps anyone else who runs into the plethora of problems that one will face when upgrading RN to 0.60

@betoharres See setup first line for iOS here: https://github.com/react-native-community/react-native-text-input-mask#setup

That is you have to do following step mentioned in above link

iOS only: you have to drag and drop InputMask.framework to Embedded Binaries in General tab of Target

@blueberry6401 Please also add use_frameworks! in pod file. And make sure you have followed the instructions from https://github.com/waqas19921/react-native-text-input-mask/blob/master/README.md

Adding use_frameworks! creates some build error that I don’t remember exactly, but after time struggling I made this worked!

@betoharres if you add following two lines in header search path

$(SRCROOT)/../../../ios/Pods/Headers/Public
$(SRCROOT)/../../../ios/Pods/Headers/Public/React-Core

with mode recursive and change the imports in RNTextInputMask.m from

#import <RCTText/RCTBaseTextInputView.h>
#import <RCTText/RCTUITextField.h>

to

#import "RCTBaseTextInputView.h"
#import "RCTUITextField.h"

It will work with RN 0.60.5 with manual integration. Usage with pods through auto linking will not work as currently the swift code or usage of frameworks is not supported in RN 0.60.5. Need to wait for following pull request to be released. facebook/react-native#25619

GOD bless you, man. It worked not only for input mask, but for all the libraries without podfiles. One thing - you have to add this search pass to the library project itself, not for your root project. Maybe also pod ‘boost-for-react-native’, :podspec => ‘https://raw.githubusercontent.com/react-native-community/boost-for-react-native/master/boost-for-react-native.podspec’ in podfile helped me

Quick Tip for those who wants to install @waqas19921 fork but wants to keep the dependency at the exact commit that he fixed the Pod support. Run the command like this:

yarn add waqas19921/react-native-text-input-mask#ce7a78f

#ce7a78f is his last commit at this time of writing.

@waqas19921 version 2.0.0 not available via npm. Can you please make it a release?