Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async preloadAssets(): Promise {
try {
if (this.props.fontAssets) {
// @ts-ignore - prop type should be correct I think the Expo type is wrong
await Font.loadAsync(this.props.fontAssets);
}
} catch (err) {
console.log(
"Error fetching providing fontAssets - please check they match the expected format. Error:",
err,
);
}
try {
await Asset.loadAsync(
[require("./stargazer.png")].concat(this.props.imageAssets || []),
);
} catch (err) {
console.log(
"Error fetching providing imageAssets - please check they match the expected format. Error:",
err,
);
}
}
_loadResourcesAsync = async () => {
return Promise.all([
Asset.loadAsync([
require('./assets/images/robot-dev.png'),
require('./assets/images/robot-prod.png'),
]),
Font.loadAsync({
// This is the font that we are using for our tab bar
...Icon.Ionicons.font,
// We include SpaceMono because we use it in HomeScreen.js. Feel free
// to remove this if you are not using it in your app
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
}),
]);
};
_loadResourcesAsync = async () => {
return Promise.all([
Asset.loadAsync([
require('./assets/images/robot-dev.png'),
require('./assets/images/robot-prod.png'),
]),
Font.loadAsync({
// This is the font that we are using for our tab bar
...Icon.Ionicons.font,
// We include SpaceMono because we use it in HomeScreen.js. Feel free
// to remove this if you are not using it in your app
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
}),
]);
};
obj.z;
});
Accelerometer.removeAllListeners();
Accelerometer.setUpdateInterval(1000);
Amplitude.initialize('key');
Amplitude.setUserId('userId');
Amplitude.setUserProperties({key: 1});
Amplitude.clearUserProperties();
Amplitude.logEvent('name');
Amplitude.logEventWithProperties('event', {key: 'value'});
Amplitude.setGroup('type', {key: 'value'});
const asset = Asset.fromModule(1);
asset.downloadAsync();
Asset.loadAsync(1);
Asset.loadAsync([1, 2, 3]);
const asset1 = new Asset({
uri: 'uri',
type: 'type',
name: 'name',
hash: 'hash',
width: 122,
height: 122
});
const url = AuthSession.getRedirectUrl();
AuthSession.dismiss();
AuthSession.startAsync({
authUrl: 'url1',
returnUrl: 'url2'
}).then(result => {
videos.map(video => Promise.all([
Asset.loadAsync(video.video),
Asset.loadAsync(video.avatar),
Asset.loadAsync(video.thumbnail),
])),
);
videos.map(video => Promise.all([
Asset.loadAsync(video.video),
Asset.loadAsync(video.avatar),
Asset.loadAsync(video.thumbnail),
])),
);
await Promise.all(sections.map(section => Asset.loadAsync(section.image)));
this.setState({ ready: true });
await Promise.all(stories.map(story => Promise.all([
Asset.loadAsync(story.source),
Asset.loadAsync(story.avatar),
])));
this.setState({ ready: true });
_loadAssetsAsync = async () => {
return Promise.all([
Asset.loadAsync([
require("./assets/images/logo.png"),
require("./assets/images/logo-white.png"),
require("./assets/images/noPhoto.jpg"),
require("./assets/images/photoPlaceholder.png")
]),
Font.loadAsync({
...Ionicons.font,
...MaterialIcons.font
})
]);
};
_handleLoadingError = error => {