Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[...] iOS on React Native 0.60(+) #28

Closed
brodybits opened this issue Jul 11, 2019 · 10 comments
Closed

[...] iOS on React Native 0.60(+) #28

brodybits opened this issue Jul 11, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@brodybits
Copy link
Owner

If I would generate a new module with an example on RN 0.60, the generated example project does not work on iOS.

Tool version: 0.5.0

Command used:

create-react-native-module --generate-example ben-alan

Debug output with error message:

2019-07-10 22:19:39.624 [info][tid:main][RCTCxxBridge.mm:236] Initializing <RCTCxxBridge: 0x7fe7be5031a0> (parent: <RCTBridge: 0x600000a347e0>, executor: (null))
2019-07-10 22:19:39.629322-0400 example[21627:1170867] Initializing <RCTCxxBridge: 0x7fe7be5031a0> (parent: <RCTBridge: 0x600000a347e0>, executor: (null))
2019-07-10 22:19:39.836 [info][tid:main][RCTRootView.m:293] Running application example ({
    initialProps =     {
    };
    rootTag = 1;
})
2019-07-10 22:19:39.836033-0400 example[21627:1170867] Running application example ({
    initialProps =     {
    };
    rootTag = 1;
})
2019-07-10 22:20:59.403488-0400 example[21627:1171076] [] nw_socket_handle_socket_event [C3.1:1] Socket SO_ERROR [61: Connection refused]
2019-07-10 22:20:59.409348-0400 example[21627:1171076] [] nw_socket_handle_socket_event [C3.2:1] Socket SO_ERROR [61: Connection refused]
2019-07-10 22:20:59.412213-0400 example[21627:1171105] [] nw_connection_get_connected_socket [C3] Client called nw_connection_get_connected_socket on unconnected nw_connection
2019-07-10 22:20:59.659 [info][tid:com.facebook.react.JavaScript] Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2019-07-10 22:20:59.659131-0400 example[21627:1171099] Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2019-07-10 22:20:59.815 [error][tid:com.facebook.react.JavaScript] TypeError: null is not an object (evaluating '_reactNativeBenAlan.default.sampleMethod')

This error is located at:
    in App (at renderApplication.js:40)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:39)
2019-07-10 22:20:59.815621-0400 example[21627:1171099] TypeError: null is not an object (evaluating '_reactNativeBenAlan.default.sampleMethod')

This error is located at:
    in App (at renderApplication.js:40)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:39)
2019-07-10 22:20:59.844 [error][tid:com.facebook.react.JavaScript] TypeError: null is not an object (evaluating '_reactNativeBenAlan.default.sampleMethod')

This error is located at:
    in App (at renderApplication.js:40)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:39)
2019-07-10 22:20:59.843901-0400 example[21627:1171099] TypeError: null is not an object (evaluating '_reactNativeBenAlan.default.sampleMethod')

This error is located at:
    in App (at renderApplication.js:40)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:39)
2019-07-10 22:20:59.854 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: TypeError: null is not an object (evaluating '_reactNativeBenAlan.default.sampleMethod')

This error is located at:
    in App (at renderApplication.js:40)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:39)
2019-07-10 22:20:59.853868-0400 example[21627:1171105] Unhandled JS Exception: TypeError: null is not an object (evaluating '_reactNativeBenAlan.default.sampleMethod')

This error is located at:
    in App (at renderApplication.js:40)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:98)
    in RCTView (at View.js:35)
    in View (at AppContainer.js:115)
    in AppContainer (at renderApplication.js:39)
2019-07-10 22:20:59.946 [info][tid:com.facebook.react.JavaScript] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:20:59.946207-0400 example[21627:1171099] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:20:59.981970-0400 example[21627:1170867] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/brodybits/Library/Developer/CoreSimulator/Devices/D3554BC6-55FA-4421-82BA-9510E66B738D/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2019-07-10 22:20:59.982485-0400 example[21627:1170867] [MC] Reading from private effective user settings.
2019-07-10 22:21:00.206 [info][tid:com.facebook.react.JavaScript] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:21:00.208203-0400 example[21627:1171099] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:21:00.228 [info][tid:com.facebook.react.JavaScript] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:21:00.228134-0400 example[21627:1171099] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:21:03.280 [info][tid:com.facebook.react.JavaScript] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:21:03.280881-0400 example[21627:1171099] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:21:05.823 [info][tid:com.facebook.react.JavaScript] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }
2019-07-10 22:21:05.823821-0400 example[21627:1171099] 'BugReporting extraData:', { 'AppRegistry.runApplication1': 'Running application "example" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF' }

See also:

@brodybits brodybits added bug Something isn't working help wanted Extra attention is needed labels Jul 11, 2019
@brodybits brodybits removed the help wanted Extra attention is needed label Jul 11, 2019
@brodybits
Copy link
Owner Author

brodybits commented Jul 11, 2019

I think we need to add react-native.config.js to the generated project, like someone proposed for react-native-google-signin in react-native-google-signin/google-signin#692.

The warning message in react-native-google-signin/google-signin#692 points to the following documentation resource:

@dsyne
Copy link
Contributor

dsyne commented Jul 16, 2019

Hey, i came across this library after trying and failing to get react-native-create-library to work however I'm having similar issues to those you describe above. I'm able to build and run the example
project using the command described in the readme:
create-react-native-module --prefix CB --package-identifier io.mylibrary --generate-example AliceHelper
It works fine on android but in iOS i get TypeError: Cannot read property 'sampleMethod' of undefined. I've tried lowering the react-native version in templates/generate.js to 0.59.10 and re-generating but am still getting the same error. Is there a way you know of to get a working example project, i'm happy to use an old version of RN etc but cant see how i can achieve this. ... Side note, if you have any primarily JS work that needs looking at, i'd be happy to chip in if it helps :)

@brodybits
Copy link
Owner Author

[…] I'm having similar issues to those you describe above. […]

I will try to fix this before making the 0.6.0 release later today. I will likely use the following PRs for examples:

I've tried lowering the react-native version in templates/generate.js to 0.59.10 and re-generating but am still getting the same error.

I think that should not make any difference.

[…] i'm happy to use an old version of RN […]

Try something like this:

react-native init my-native-module --version react-native@0.59

Side note, if you have any primarily JS work that needs looking at, i'd be happy to chip in if it helps :)

Thanks for the offer. There are a few issues that I think should be “pure JS”, for example: #15

@brodybits brodybits added the help wanted Extra attention is needed label Jul 16, 2019
@brodybits
Copy link
Owner Author

I suspect that the iOS Podfile is needed to work with React Native 0.60. I tried using the new --use-cocoapods option but then run into an issue with duplicated modules on Haste. So I will release version 0.6.0 now and try to solve this issue sometime later. Any help from others would be highly appreciated.

@dsyne
Copy link
Contributor

dsyne commented Jul 17, 2019

Thank you for the quick response, I installed the dev branch and it's working 👌. I'll fork now and have a look at #15

@brodybits

This comment has been minimized.

@brodybits brodybits removed the help wanted Extra attention is needed label Jul 22, 2019
@brodybits
Copy link
Owner Author

brodybits commented Jul 22, 2019

Here is how I was able to resolve this issue for the generated example on iOS:

  • do react-native link <module name> in the generated example (not needed)
  • do pod install in the ios subdirectory of the generated example manually

My first attempt to update lib/lib.js to automatically do pod install in the ios subdirectory of the generated example did not seem to work for me. I hope to get this working someday. I think the right solution for now is to simply document this.

@douglowder
Copy link
Collaborator

Is the issue that pod install won’t work until you run yarn install in the generated example?

@brodybits brodybits changed the title Does not work on iOS with React Native 0.60 Support iOS on React Native 0.60(+) Sep 9, 2019
@brodybits
Copy link
Owner Author

Is the issue that pod install won’t work until you run yarn install in the generated example?

I really don't remember. Further response should be coming soon.

@brodybits brodybits changed the title Support iOS on React Native 0.60(+) [...] iOS on React Native 0.60(+) Sep 9, 2019
@brodybits
Copy link
Owner Author

discussion is now continued in #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants