Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
action: {
title: 'OK',
color: 'rgb(0, 148, 255)',
},
});
return;
}
await AsyncStorage.setItem('token', token); // Stores the token on the storage
return this.startViewAnimated();
} catch (err) {
console.log(err.message);
Snackbar.show({
title: 'An unexpected error occurred',
duration: Snackbar.LENGTH_INDEFINITE,
action: {
title: 'OK',
color: 'rgb(0, 148, 255)',
},
});
}
};
}
Snackbar.show({
title: 'The user has been added! Want to make the login?',
duration: Snackbar.LENGTH_INDEFINITE,
action: {
title: 'MAKE LOGIN',
color: 'rgb(0, 148, 255)',
action: () => this.goToFeed(token),
},
});
} catch (err) {
console.log(err.message);
Snackbar.show({
title: 'An unexpected error occurred',
duration: Snackbar.LENGTH_INDEFINITE,
action: {
title: 'OK',
color: 'rgb(0, 148, 255)',
},
});
}
};
if (token == null) {
Snackbar.show({
title: 'Email already in use',
duration: 3000,
action: {
title: 'DISMISS',
color: 'rgb(0, 148, 255)',
action: () => this.goToFeed(),
},
});
return;
}
Snackbar.show({
title: 'The user has been added! Want to make the login?',
duration: Snackbar.LENGTH_INDEFINITE,
action: {
title: 'MAKE LOGIN',
color: 'rgb(0, 148, 255)',
action: () => this.goToFeed(token),
},
});
} catch (err) {
console.log(err.message);
Snackbar.show({
title: 'An unexpected error occurred',
duration: Snackbar.LENGTH_INDEFINITE,
action: {
title: 'OK',
color: 'rgb(0, 148, 255)',
},
});
render={({ error, props }) => {
if (error) {
return Snackbar.show({
title: 'An unexpected error occurred',
duration: Snackbar.LENGTH_INDEFINITE,
action: {
title: 'OK',
color: 'rgb(0, 148, 255)',
},
});
} else if (props) {
return ;
}
return (
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import Colors from 'styles/Colors';
import Snackbar from 'react-native-snackbar';
export default class SnackbarUtils {
static DURATION_SHORT = Snackbar.LENGTH_SHORT;
static DURATION_LONG = Snackbar.LENGTH_LONG;
static DURATION_INDEFINITE = Snackbar.LENGTH_INDEFINITE;
static showWarning(options) {
SnackbarUtils.showAlert({
type: 'warning',
...options,
});
}
static showInfo(options) {
SnackbarUtils.showAlert({
type: 'info',
...options,
});
}
static showSuccess(options) {
componentDidUpdate(prevProps) {
if (this.props.checkmate !== prevProps.checkmate && this.props.checkmate) {
Snackbar.show({
title: strings.gameOver[this.props.lang],
duration: Snackbar.LENGTH_INDEFINITE,
action: {
title: strings.takeLook[this.props.lang],
color: "green",
onPress: () => {
this.props.navigate("Play");
}
}
});
}
}