Comments (2)
This experience really helped me.. and.. How about if we do it this way ...
- RNApp/app/index.js
const RNApp = (props) => {
const { status, user, loggingIn } = props;
console.log('props', props);
if (status.connected === false){
return <Loading />;
} else if(user !== null){
return <LoggedIn />;
} else {
return <LoggedOut />;
}
};
- RNApp/app/routes/SignIn/SignInContainer.js
handleSignIn() {
const { username, email, password, confirmPasswordInputVisible } = this.state;
if (!confirmPasswordInputVisible && this.validInput(true)) {
//NOTE because react-native-meteor doesn't login right away after sign in
//Meteor.loginWithPassword(email, password, (err) => {
Meteor.loginWithPassword(username, password, (err) => {
if (err) {
console.log(err.reason);
this.setState({ confirmPasswordInputVisible: true });
} else {
console.log('login success!');
this.setState({ error: 'no error'});
}
});
} else {
if(confirmPasswordInputVisible !== false) {
LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
this.setState({ confirmPasswordInputVisible: false });
this.setState({ error: null });
}
}
}
handleCreateAccount() {
const { username, email, password, confirmPasswordInputVisible } = this.state;
if(confirmPasswordInputVisible && this.validInput()) {
//Account.createUser({ email, password }, (err) => {
Accounts.createUser({ username: username, password: password }, (err) => {
if(err) {
this.setState({ error: err.reason });
} else {
//NOTE because react-native-meteor doesn't login right away after sign in
this.setState({ confirmPasswordInputVisible: false });
Meteor.loginWithPassword(username, password, (err) => {
if (err) {
this.setState({
error: err.reason,
confirmPasswordInputVisible: true
});
} else {
console.log('login success!');
}
});
}
});
} else {
if(confirmPasswordInputVisible !== true) {
LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
this.setState({ confirmPasswordInputVisible: true });
this.setState({ error: null });
}
}
}
from react-native-meteor-boilerplate.
This is very similar to #21 so I'm going to close this in favor of consolidating issues. I haven't thought through the issue yet but it's on my radar!
from react-native-meteor-boilerplate.
Related Issues (20)
- Permission react-native-meteor HOT 2
- Best way to change bottom tabs based on current screen? HOT 4
- Sharing code between the client and the server HOT 1
- Update Boilerplate HOT 1
- Where to hide splash screen ? HOT 2
- iOS Device build successful however DDP fails to connect HOT 2
- Failing in simulation with TransformError HOT 2
- Thoughts on new "Meteor Client Bundler" vs react-native-meteor? HOT 1
- Failed to release in iOS HOT 1
- :-) Thank you for building this, we'll be in touch soon. I appreciate it.
- Failure of App to Register
- check ddp server conection HOT 1
- Unable to resolve module react-native/Libraries/Renderer/shims/ReactNative ... HOT 8
- App crashes in Xcode HOT 3
- Issues getting Meteor data into React Native using createContainer HOT 1
- What would be the best way to change the title by passing a parameter? HOT 1
- Is it possible to implement the login to meteor from react-native without eject HOT 1
- app crashes immediately HOT 3
- Is it possible to use same code for mobile and web and what I need to do. HOT 1
- Is it possible to use this boilerplate to integrate RN to an existing Meteor App? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-meteor-boilerplate.