RCTView generated view config for bubblingEventTypes does not match native, missing: topPointerOver topPointerLeave topPointerMove topPointerEnter topPointerUp topPointerDown topPointerOut topPointerCancel
Context for a good solution (short question in bottom).
I have a database (API) which generate list of data of apps like AppA, AppB, AppC, etc. with their name, path...
With a map, I generate (react router) links to these apps based on this data list (in the main <App/>) and front.
With another identical map (below), I have made the router which should call the App based on the route and app name:
function(Router) {
const [routes, setRoutes] = useState([]);
useEffect(() => {
fetch("MyAPI")
.then(res => res.json())
.then((result) => {setRoutes(result.results)}
)
}, [])
// The route for each app and after the map, the route to the home with these links
return (
<Switch>{
routes.map(result =>
<Route exact path={"/"+result.route} key={keygen(16)}>
<AppCaller name={result.name} id={result.id} path={"/"+result.route}/>
</Route>
)}
<Route exact path="/">
<App />
</Route>
</Switch>
)
}
export default Router
My first problem is I cannot neither give a component Name like <result.name/> from the API to call this component in the Router nor import dynamically this component.
My first solution was to create another component <AppCaller/> with the name and path as Props to remove the component problem like this :
import React from "react";
import Window from "./dashComponents"
import subApp from "./Apps/Store"
class AppCaller extends React.Component {
render() {
return (
<Window name={this.props.name}>
<subApp/>
</Window>
)
}
}
export default AppCaller
In fact, I can keep the <subApp/> name even if the app is different. The only thing i need to change is the "where" is the app comes from.
Begin of short question
So, How can I change the path of the import statement to "import" the good App in this dynamic component ? (with a Props in this case)
import subApp from this.props.path
This may looks like this (if it was static):
import subApp from "./Apps/App1" in the App1 file
import subApp from "./Apps/App1" in the App2 file etc.
Another idea seen in React Documentation and in Stack Overflow is to use Lazy Import but it does not works:
import React, {Suspense} from "react";
import Window from "./dashComponents"
//import subApp from "./Apps/Store"
const path = this.props.path
let name = this.props.name
function AppCaller() {
const SubApp = React.lazy(() => import('./Apps/'+name))
return (
<Window name={name}>
<Suspense fallback={<h2>"Chargement..."</h2>}>
<SubApp/>
</Suspense>
</Window>
)
}
export default AppCaller
OR
class AppCaller extends React.Component {
render() {
const SubApp = React.lazy(() => import('./Apps/'+this.props.name));
return (
<Window name={this.props.name}>
<Suspense fallback={"Chargement..."}>
<SubApp/>
</Suspense>
</Window>
)
}
}
export default AppCaller
"The above error occured in one of your React Component..."
Thank you for your help.
I Try to be very accurate and find everywhere. So please, be free to tell me precision before judging.
Edit 1 with full Error
I have this error when I click in one of the links generated.
The above error occurred in one of your React components:
in Unknown (created by AppCaller)
in Suspense (created by AppCaller)
in div (created by Window)
in Window (created by AppCaller)
in AppCaller (created by RoutesX)
in Route (created by RoutesX)
in Switch (created by RoutesX)
in RoutesX
in div
in Router (created by BrowserRouter)
in BrowserRouter
Consider adding an error boundary to your tree to customize error handling behavior.
Visit 'Facebook' to learn more about error boundaries.
Edit 2 with initial Error
react-dom.development.js:11865 Uncaught ChunkLoadError: Loading chunk 0 failed.
(error: http://dash.localhost:8000/0.main.js)
at Function.requireEnsure [as e] (http://dash.localhost:8000/static/frontend/main.js:106:26)
at eval (webpack:///./src/components/AppCaller.js?:45:36)
at initializeLazyComponentType (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:1432:20)
at readLazyComponentType (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:11862:3)
...
requireEnsure # main.js:106
eval # AppCaller.js:45
...
And
0.main.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Ok Everybody !
So, it was not a React but a Webpack problem !
When you use a React lazy to import specific component, and you "compile" with npm run dev (or build) webpack split the code by Chunck but the configuration file is wrong.
Here's my configuration file which works:
module.exports = {
output: {
filename: 'App.js',
publicPath: '/static/frontend/',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
I needed to add the "public path" to the path of the "chunck' scripts. :)
Trying to add a to an existing React component but running into some difficulties. Given the following code
import { Link } from 'react-router-dom';
require('./NavBar.scss');
class NavBar extends React.Component {
authButton() {
console.log(Link)
const route = this.props.currentUser ? 'logout' : 'login';
return <Link to={ `/${route}` }>route</Link>
}
The navbar component fails to render and I get this error
Uncaught TypeError: Object(...) is not a function
at eval (react-router-dom.js:198)
If I change the "to" prop to a function like this
return <Link to={ () => return `/${route}` }>route</Link>
the component does actually render but I get this message "checkPropTypes.js:19 Warning: Failed prop type: Invalid prop to supplied to Link."
Any idea on what could be causing this. Have used this component on the same version of react-router-dom (5.0.0) on other projects without issue.
Try to use it with withRoute from react-router-dom. In the bottom of the file, export default navbar, write this line
export default withRoute(navbar)
Don't forget import it from react-router-dom.
There's usually a problem with react-router-dom when the component isn't included in Route element in the 'main component' such App.js.
<Route path='/' component={}
Something like that.
I'm assuming this since a lot of people get this problem with React-router-dom.
So I am trying to use this https://github.com/seeden/react-facebook as part of my hybrid react app. However when I copy and paste the code into my project it gives me an error
import React, {Component } from 'react';
import { FacebookProvider, Page } from 'react-facebook';
//import {createBottomTabNavigator, createAppContainer} from 'react-
navigation';
export default class Home extends Component {
render(){
//const { navigate } = this.props.navigation
return (
<FacebookProvider appId="2319566588264121">
<Page href="https://www.facebook.com/somepage/" tabs="timeline"
/>
</FacebookProvider>
);
}
}
The idea is to have a facebooks pages feed show up on my app screen. However I get this error:
Invariant Violation: View config not found for name div. Make sure to start component names with a capital letter.
This error is located at:
in div (created by Page)
in Page (created by Parser)
in Initialize (created by Context.Consumer)
in ForwardRef (created by Parser)
in div (created by Parser)
in Parser (created by ForwardRef)
in ForwardRef (at Home.js:18)
in Facebook (at Home.js:17)
in Home (at SceneView.js:0)
in SceneView (at createTabNavigator.js139)
in RCTView (at View.js:45)
in View (at ResourceSavingScene.js:37)
in RCTView (at View.js:45)
in View (at ResourceSavingScene.js:26)
in ResourceSavingScene (at createllottomTabNavigatorls:121)
in RCTView (at View.js:45)
in View (at screens.native.js:83)
in ScreenContainer (at create00ttomTabNavigator.js:111)
in RCTView (at View.js:46)
in View (at createBottomTabNavigator.js: 110)
in TabNavigationView (at createTabNavigator.js:197)
in NavigationView (at createNavigator.js:61)
in Navigator (at createAppContainer.js:429)
in NavigationContainer (at . .
It looks like seeden/react-facebook is built for browsers and the DOM. You cannot use <div> and the likes in React Native -- This means you have to implement this library yourself, or find something else that is React Native compatible
Yes,components' names must start with capital letter , because , when you write component name with small letter , compiler runs it like as html tag, but when you write with capital letter , compiler runs it from your javascript file location.
I just upgraded my fully functional react-native app to Redux v4, but now I am getting the following error:
Error: Error: Error: Error: You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.
I suspect the problem is that I have numerous components inside others, each with their own connect(mapStateToProps, mapDispatchToProps)(Component) and I suppose this is not the correct way to implement it, though I am not sure the proper way to go about it.
Any direction is greatly appreciated!
Stack Trace:
This error is located at:
in Connect(SideBarApp) (at SceneView.js:9)
in SceneView (at createTabNavigator.js:10)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in ResourceSavingScene (at createBottomTabNavigator.js:86)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in TabNavigationView (at createTabNavigator.js:127)
in NavigationView (at createNavigator.js:59)
in Navigator (at createNavigationContainer.js:376)
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:59)
in Navigator (at createNavigationContainer.js:376)
in NavigationContainer (at AppNavigator.js:36)
in App (created by Connect(App))
in Connect(App) (at index.ios.js:23)
in Provider (at index.ios.js:22)
in TheNewsApp (at renderApplication.js:32)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in AppContainer (at renderApplication.js:31)
This error is located at:
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:59)
in Navigator (at createNavigationContainer.js:376)
in NavigationContainer (at AppNavigator.js:36)
in App (created by Connect(App))
in Connect(App) (at index.ios.js:23)
in Provider (at index.ios.js:22)
in TheNewsApp (at renderApplication.js:32)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in AppContainer (at renderApplication.js:31)
This error is located at:
in NavigationContainer (at AppNavigator.js:36)
in App (created by Connect(App))
in Connect(App) (at index.ios.js:23)
in Provider (at index.ios.js:22)
in TheNewsApp (at renderApplication.js:32)
in RCTView (at View.js:43)
in RCTView (at View.js:43)
in AppContainer (at renderApplication.js:31)
getState#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:79579:24
runComponentSelector#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:78896:56
initSelector#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:79019:28
Connect(SideBarApp)#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:78969:29
constructClassInstance#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:20826:32
updateClassComponent#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:22393:35
performUnitOfWork#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:24922:27
workLoop#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:24955:47
renderRoot#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:24988:21
performWorkOnRoot#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25549:23
performWork#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25481:30
performSyncWork#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25456:20
requestWork#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25362:26
scheduleWork#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:25224:28
enqueueSetState#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:20681:23
setState#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:2380:37
dispatch#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:80901:27
navigate#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:80517:24
nav#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:80470:44
combination#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:79810:38
dispatch#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:79628:38
setLoginStatus#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:112247:19
http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:112199:44
tryCallOne#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:8818:16
http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:8919:27
_callTimer#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:8162:17
_callImmediatesPass#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:8198:19
callImmediates#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:8417:33
__callImmediates#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7741:32
http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7580:34
__guard#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7721:15
flushedQueue#http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:7579:21
flushedQueue#[native code]
invokeCallbackAndReturnFlushedQueue#[native code]
It's an issue with the new v2.16.0 release of redux-devtools-extension.
Here's a couple of workaround while we wait for the fix...
Revert back to the working version v2.15.5 (For Chrome)
Download https://github.com/zalmoxisus/redux-devtools-extension/releases/download/2.15.5/extension.zip
Extract the zip
Type chrome://extensions into the url and toggle on developer mode on the top right of the page.
The button Load Unpacked will appear. After clicking the button, select the extracted folder.
Or just simply disable your redux-devtool extension for now.
either on the browser level or through your code(where you create the redux store)
FYI: this does not solve the OP's question but does solve the issue where developers are receiving the below error message starting 11/27/18.
Error: You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.
UPDATE
v2.16.2 has been released
For those who had previously disabled the extension, just re-enable it and Update your redux dev tools from 2.16.0 to 2.16.2 Update Redux Dev tools
In my case, I have to remove composeWithDevTools - a plugin for chrome
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
// const enhancer = composeWithDevTools(applyMiddleware(thunk))
const enhancer = applyMiddleware(thunk)
const store = createStore(reducers, enhancer);
In my project. This issue just popup from nowhere one day.
My solution: Disable the Chrome extension - Redux Devtools.
Then everything is back to normal.
So with this kind of error, you should test in several browser to find the problem.
tl;dr
Make sure you don't have any code that causes side effects in your reducers!
Pure reducers
Redux reducers need to be pure. This means they shouldn't have side effects. Side effects should go to thunks or sagas. In my case a reducer looked like this:
case REDIRECT_ON_EVENT: {
history.push('/some-route'); // side effect: redirection
return {
...state,
path: action.payload.path,
};
}
The history.push('/some-route'); part messed up state management. Removing it from the reducer and placing it to a saga that gets called on the same action type fixed the issue:
function redirectToSomeRoute() {
history.push('/some-route');
}
takeEvery(REDIRECT_ON_EVENT, redirectToSomeRoute),
Disabling chrome extension or removing composeWithDevTool from your code will work as a quick fix. But we all know that we need the extension in order to track our application state and manage it properly. So I created an issue today please support hopefully, someone from the redux team will get back to us.
Or if you are looking for a temporary workaround(for chrome), you can download https://github.com/zalmoxisus/redux-devtools-extension/releases/download/2.15.5/extension.zip and then extract it to some folder.
Type chrome://extensions and turn on developer mode from top left and then click on Load Unpacked and select the extracted folder for use.
Issue: https://github.com/reduxjs/redux-devtools/issues/413
Solution That work for me
Disable the Chrome extension of Redux Dev tools. or remove logger from your code.
update: Update your redux dev tools from 2.16.0 to 2.16.1
Update Redux Dev tools.
In my case the issue was not related to dev extension. I've encountered this error while working with deep-linking - was updating route query inside reducer. Wrapping logic related to manipulating url inside settimeout fixed the error.
I had the same error with a PWA build with polymer 3.
The store.js also tried to use the redux dev tools which I had to deactivate:
...
// Sets up a Chrome extension for time travel debugging.
// See https://github.com/zalmoxisus/redux-devtools-extension for more information.
//const devCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const devCompose = compose;
// Initializes the Redux store with a lazyReducerEnhancer (so that you can
// lazily add reducers after the store has been created) and redux-thunk (so
// that you can dispatch async actions). See the "Redux and state management"
// section of the wiki for more details:
// https://github.com/Polymer/pwa-starter-kit/wiki/4.-Redux-and-state-management
export const store = createStore(
state => state,
devCompose(
lazyReducerEnhancer(combineReducers),
applyMiddleware(thunk))
);
...
This is what I did: Just commented the line for Chrome Redux Devtools Extension from my store.js file.
....
const store = createStore(
rootReducer,
initialState,
compose(
applyMiddleware(...middleware)
///This line--> window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
)
);
....
And the issue is just begun an hour ago. As we all know the extension is very handy during development, so let us wait for the real fix from the authorities.
Should be fixed now. Update your redux dev tools from 2.16.0 to 2.16.1
https://github.com/zalmoxisus/redux-devtools-extension/issues/588#issuecomment-442396540
I had this problem on Chrome. Downgrading my version of redux from 4.0.2 to 3.7.2 fixed it for me.
npm uninstall redux
npm install redux#3.7.2
Note: I am using Saga
In my case I had added a navigation code inside a reducer.
sendOTPSuccess: (state, action) => {
state.wip = false;
RootNavigation.navigate('LoginOTPScreen');
},
In the beginning it was working but when I used/accessed state inside the called new Screen
import { useDispatch, useSelector } from "react-redux";
import * as sessionActions from "../../models/session";
const LoginOTP: () => Node = (props) => {
const session = useSelector(sessionActions.selectSession);
const dispatch = useDispatch();
...
the error popped up.
“Error: You may not call store.getState() while the reducer is executing.”
Cause
Reducer is supposed to be a pure function. It should accept a payload and modify state and nothing else. Something else is considered as a side-effect.
I my case I loaded a new component which also consumes state data and the state modification is not yet completed. This is causing the issue.
Solution
I simply moved the navigation to respective saga
// worker Saga:
function* sendOTPSaga({ payload }) {
const { phoneNumber } = payload;
try {
const response = yield call(Api.sendOtp, { phoneNumber });
if (response.status == 200) {
yield put(sessionActions.sendOTPSuccess(response.data));
RootNavigation.navigate('LoginOTPScreen'); // <---- Here
...