Jan
22
12 hours ago
Activity icon
fork

baristure forked facebook/react-native

⚡ A framework for building native applications using React
baristure Updated
fork time in 15 minutes ago
started
started time in 15 minutes ago
Activity icon
issue

cmschandan issue facebook/react-native

cmschandan
cmschandan

ERROR Invariant Violation: Module AppRegistry is not a registered callable module ( React native V6)

Description

ERROR TypeError: undefined is not an object (evaluating 'Object.keys(o)') ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

Version

0.67

Output of npx react-native info

BUNDLE ./index.js

ERROR TypeError: undefined is not an object (evaluating 'Object.keys(o)') ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. [Info] Stopping Packager

Steps to reproduce

Whenever i am adding StackNavigator code in my App.js then showing above issue.. I tried all possible solution to resolve it. but it's showing same bug again and again.

Snack, code example, screenshot, or link to a repository

App.js `import {NavigationContainer} from '@react-navigation/native'; import React from 'react'; import 'react-native-gesture-handler'; import {createStackNavigator} from 'react-navigation-stack'; import Home from './Home';

const Stack = createStackNavigator(); const SectionListBasics = () => { return ( <> <Stack.Navigator initialRouteName="Home" headerMode="Screen"> <Stack.Screen name="Home" options={{ headerShown: false, }}> {props => <Home {...props} username="Sports Fan" />} </Stack.Screen> </Stack.Navigator> </> ); };

export default SectionListBasics; `

package.json { "name": "AwesomeProject", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-community/masked-view": "^0.1.11", "@react-navigation/bottom-tabs": "^6.0.9", "@react-navigation/drawer": "^6.1.8", "@react-navigation/native": "^6.0.6", "react": "17.0.2", "react-native": "0.67.1", "react-native-gesture-handler": "^2.2.0", "react-native-reanimated": "^2.2.4", "react-native-safe-area-context": "^3.3.2", "react-native-screens": "^3.10.2", "react-native-vector-icons": "^9.0.0", "react-navigation-stack": "^2.10.4" }, "devDependencies": { "@babel/core": "7.16.10", "@babel/runtime": "7.16.7", "@react-native-community/eslint-config": "2.0.0", "babel-jest": "26.6.3", "eslint": "7.14.0", "jest": "26.6.3", "metro-react-native-babel-preset": "0.66.2", "react-test-renderer": "17.0.2" }, "jest": { "preset": "react-native" } }

Activity icon
issue

joaocarmo issue comment facebook/react-native

joaocarmo
joaocarmo

mockModal is not a function

Description

After upgrading from 0.66.4 to 0.67.1, Jest tests that previously passed suddenly fail with the following error:

    TypeError: mockModal is not a function

      153 |       return (
    > 154 |         <Modal onRequestClose={handleRequestClose}>
          |          ^

      at ../../../node_modules/react-native/jest/setup.js:116:12
      at Object.get Modal [as Modal] (../../../node_modules/react-native/index.js:165:12)
      at VideoMedia.render (src/components/MyComponent.js:154:10)
      at finishClassComponent (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8459:31)
      at updateClassComponent (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8409:24)
      at beginWork (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9990:16)
      at performUnitOfWork (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13800:12)
      at workLoopSync (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13728:5)
      at renderRootSync (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13691:7)
      at performSyncWorkOnRoot (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13404:18)
      at ../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2537:26
      at unstable_runWithPriority (../../../node_modules/scheduler/cjs/scheduler.development.js:468:12)
      at runWithPriority (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2486:10)
      at flushSyncCallbackQueueImpl (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2532:9)
      at flushSyncCallbackQueue (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2519:3)
      at batchedUpdates (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13459:7)
      at act (../../../node_modules/react-test-renderer/cjs/react-test-renderer.development.js:15280:14)
      at invokeEvent (../../../node_modules/@testing-library/react-native/build/fireEvent.js:93:20)
      at Function.press (../../../node_modules/@testing-library/react-native/build/fireEvent.js:101:33)

Version

0.67.1

Output of npx react-native info

System:
    OS: macOS 12.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.25 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - /private/var/folders/93/1k48nb2j093b_cfpbcf6cq1n4c68j2/T/xfs-df80a4e7/node
    Yarn: 3.0.2 - /private/var/folders/93/1k48nb2j093b_cfpbcf6cq1n4c68j2/T/xfs-df80a4e7/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2021.10.18.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /Users/z004bmc/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7678000
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Use Modal in a component, write a Jest test for that component, get error for mockModal not being a function.

Snack, code example, screenshot, or link to a repository

No response

joaocarmo
joaocarmo

@tmikeschu, just open the file node_modules/react-native/jest/setup.js and apply the changes suggested by @omar-bizreh, then you can commit and automate those changes with patch-package until an official fix is released.

Activity icon
issue

tamis-laan issue comment facebook/react-native

tamis-laan
tamis-laan

Flatlist width height onLayout, incorrectly calculated?

Description

Not sure if this is a bug, I'm trying to build a vertical carousel that can be inserted as a child in any view and will scale accordingly. To do this I'm using the onLayout prop to derive the width and height of the carousel and pass this onto the children:

<FlatList
	style={styles.FlatList}
	contentContainerStyle={styles.FlatListContainer}
	onLayout={ e => {
		const {width,height} = e.nativeEvent.layout
		setWidth(width)
		setHeight(height)
		console.log(width,height)
	}}
        data={myData}
        renderItem={ ({item}) => (<Item style={{width,height}} data={item} />) }
/>

I'm using the following style to fit the FlatList component inside it's parent component:

// Styles
const styles = StyleSheet.create({
	FlatList: {
		flexGrow:1,
	},
	FlatListContainer: {
		flex:1,
	},
})

The problem is that the derived Item is set to large causing the carousel to be misaligned. If however is set the width and height of the FlatList to be 200x200 then everything works fine.

Version

42.0.0

Output of npx react-native info

Binaries: Node: 16.11.1 - /tmp/yarn--1642800594989-0.03596368942784878/node Yarn: 1.22.17 - /tmp/yarn--1642800594989-0.03596368942784878/yarn npm: 8.1.3 - /usr/bin/npm Watchman: Not Found SDKs: Android SDK: Not Found Languages: Java: 17.0.1 - /usr/bin/javac Python: 3.9.7 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2 npmGlobalPackages: react-native: Not Found

Steps to reproduce

See description above

Snack, code example, screenshot, or link to a repository

No response

tamis-laan
tamis-laan

If I print out the information derived from onLayout:

onLayout={ e => {
    console.log(e.nativeEvent.layout)
}}

I get back:

{
  "height": 843.6363525390625,
  "width": 392.7272644042969,
  "x": 0,
  "y": 0,
}

This is wrong given that the FlatList component is underneath another component so I would expect x > 0. Also a height of 843.6363525390625 is to big.

Activity icon
issue

tamis-laan issue comment facebook/react-native

tamis-laan
tamis-laan

Flatlist width height onLayout, incorrectly calculated?

Description

Not sure if this is a bug, I'm trying to build a vertical carousel that can be inserted as a child in any view and will scale accordingly. To do this I'm using the onLayout prop to derive the width and height of the carousel and pass this onto the children:

<FlatList
	style={styles.FlatList}
	contentContainerStyle={styles.FlatListContainer}
	onLayout={ e => {
		const {width,height} = e.nativeEvent.layout
		setWidth(width)
		setHeight(height)
		console.log(width,height)
	}}
        data={myData}
        renderItem={ ({item}) => (<Item style={{width,height}} data={item} />) }
/>

I'm using the following style to fit the FlatList component inside it's parent component:

// Styles
const styles = StyleSheet.create({
	FlatList: {
		flexGrow:1,
	},
	FlatListContainer: {
		flex:1,
	},
})

The problem is that the derived Item is set to large causing the carousel to be misaligned. If however is set the width and height of the FlatList to be 200x200 then everything works fine.

Version

42.0.0

Output of npx react-native info

Binaries: Node: 16.11.1 - /tmp/yarn--1642800594989-0.03596368942784878/node Yarn: 1.22.17 - /tmp/yarn--1642800594989-0.03596368942784878/yarn npm: 8.1.3 - /usr/bin/npm Watchman: Not Found SDKs: Android SDK: Not Found Languages: Java: 17.0.1 - /usr/bin/javac Python: 3.9.7 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2 npmGlobalPackages: react-native: Not Found

Steps to reproduce

See description above

Snack, code example, screenshot, or link to a repository

No response

tamis-laan
tamis-laan

you might wanna supply a getItemLayout prop to your FlatList.

Could you elaborate a little bit more?

started
started time in 2 hours ago
started
started time in 2 hours ago
started
started time in 2 hours ago
Activity icon
issue

link-zh issue comment facebook/react-native

link-zh
link-zh

The following build commands failed: PhaseScriptExecution [CP-User]

Description

export VERSION_INFO_FILE=FBReactNativeSpec_vers.c export VERSION_INFO_STRING="@PROGRAM:FBReactNativeSpec\ \ PROJECT:Pods-" export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES=NO export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode export XCODE_PRODUCT_BUILD_VERSION=13C100 export XCODE_VERSION_ACTUAL=1321 export XCODE_VERSION_MAJOR=1300 export XCODE_VERSION_MINOR=1320 export XPCSERVICES_FOLDER_PATH=/XPCServices export YACC=yacc export arch=undefined_arch export variant=normal /bin/sh -c /Users/link/Library/Developer/Xcode/DerivedData/rnApp-blqornskbkxcupglcsclzbmwefcw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh Command PhaseScriptExecution failed with a nonzero exit code

objc[40706]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1fc18ab90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1040482c8). One of the two will be used. Which one is undefined. objc[40706]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1fc18abe0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104048318). One of the two will be used. Which one is undefined. ** BUILD FAILED **

The following build commands failed: PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/link/Library/Developer/Xcode/DerivedData/rnApp-blqornskbkxcupglcsclzbmwefcw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh (in target 'FBReactNativeSpec' from project 'Pods')

Version

0.67.1

Output of npx react-native info

System: OS: macOS 12.1 CPU: (10) arm64 Apple M1 Pro Memory: 105.55 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.0.0 - ~/.nvm/versions/node/v16.0.0/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.0.0/bin/yarn npm: 7.10.0 - ~/.nvm/versions/node/v16.0.0/bin/npm Watchman: 2022.01.03.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.2 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 17.0.0 => 17.0.0 react-native: 0.67.1 => 0.67.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

After creating a new project 'pod install', there are times of errors in executing 'yarn ios', but it can work by executing' sudo yarn ios'

Snack, code example, screenshot, or link to a repository

No response

link-zh
link-zh

I downgraded react-native to 0.66.0 and it works

Previous