niryo / controllerim Goto Github PK
View Code? Open in Web Editor NEWA state management library for React
License: MIT License
A state management library for React
License: MIT License
Controllerim seems to clash with React Navigation... when I try to navigate to a different page it's throwing the error `TypeError: Cannot read property 'findIndex' of undefined
It seems like I can navigate to another page if I remove this.controller = new SplashController(this)
but obviously then I can't use the controller
And if I don't try to navigate to a different page then the page renders properly with the above line of code included
Any ideas?
Is there a way to use controllerim with functional react components?
This library looks great but we have a requirement that we must write everything in typescript. Do you have any plans to add the typings for this project?
When writing a Jest test for a App.jsx based AppController.js function using the TestUtils.getControllerOf(component.instance()) statement, I receive the following error:
TypeError: cannot read property '__reactViewControllersIdForTesting' of null.
`
describe("App Controller", () => {
beforeEach(() => {
TestUtils.init();
});
afterEach(() => {
TestUtils.clean();
});
it("should login the user via the login function", () => {
const component = mount();
const controller = TestUtils.getControllerOf(component.instance());
const user = controller.login('[email protected]', 'myP@sswd');
expect(user).toEqual({
email: "[email protected]",
username: 'user'
});
});`
React: 16.8.6
Controllerim: 1.62.0
Jest: 24.7.1
Hello,
After a production build yarn build
, controllerim returns the wrong controller.
The following scenario is based on the code available here.
Do not hesitate if you have any question.
It is the first time I use controllerim so I may have missed something.
Have a good day,
Run yarn start
and open http://localhost:3000.
Open the DevTools console to see the following traces:
OK HeaderComponent.js:19
OK MenuComponent.js:19
OK MenuComponent.js:28
Run yarn build
then serve -s build
Open http://localhost:5000.
Open the DevTools console to see the following traces:
OK HeaderComponent.js:19
OK MenuComponent.js:19
KO MenuComponent.js:31
ApplicationController
|
|- HeaderController
|
|- MenuController
Controllerim uses constructor.name
as key for controllers.
In this example, after the minification process, the controllerName value is equal to "t" for every controller.
So in the MenuComponent, the this.controller.getParentController(HeaderController.name)
is equivalent to this.controller.getParentController('t')
.
In the getControllerFromContext
function of controllerim, this name is used to find the related controller and return the first one which match this name.
In our case, it will be ApplicationController whereas we want to retrieve the HeaderController and so the following verification failed.
if(headerController.iAmHeaderController) {
console.log('OK');
}
else {
console.error('KO');
}
Would you consider to port controllerim to Flutter?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.