parent
c9678e6e7a
commit
0f495be35f
@ -0,0 +1,15 @@
|
|||||||
|
> Why do I have a folder named ".expo" in my project?
|
||||||
|
|
||||||
|
The ".expo" folder is created when an Expo project is started using "expo start" command.
|
||||||
|
|
||||||
|
> What do the files contain?
|
||||||
|
|
||||||
|
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
|
||||||
|
- "packager-info.json": contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.
|
||||||
|
- "settings.json": contains the server configuration that is used to serve the application manifest.
|
||||||
|
|
||||||
|
> Should I commit the ".expo" folder?
|
||||||
|
|
||||||
|
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
|
||||||
|
|
||||||
|
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"hostType": "lan",
|
||||||
|
"lanType": "ip",
|
||||||
|
"dev": true,
|
||||||
|
"minify": false,
|
||||||
|
"urlRandomness": null,
|
||||||
|
"https": false
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="FLOW" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,20 +0,0 @@
|
|||||||
import { StatusBar } from 'expo-status-bar';
|
|
||||||
import { StyleSheet, Text, View } from 'react-native';
|
|
||||||
|
|
||||||
export default function App() {
|
|
||||||
return (
|
|
||||||
<View style={styles.container}>
|
|
||||||
<Text>Open up App.js to start working on your app!</Text>
|
|
||||||
<StatusBar style="auto" />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
flex: 1,
|
|
||||||
backgroundColor: '#fff',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
});
|
|
@ -0,0 +1,33 @@
|
|||||||
|
import {StatusBar} from 'expo-status-bar';
|
||||||
|
import {StyleSheet, Text, View} from 'react-native';
|
||||||
|
import {JokeStub} from "./model/JokeStub";
|
||||||
|
import {JokeFactory} from "./model/JokeFactory";
|
||||||
|
import {loadExtensions} from "./extensions";
|
||||||
|
loadExtensions();
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
let customJokes = JokeFactory.createCustomJokes(JokeStub.customJokes);
|
||||||
|
let samplesJokes = JokeFactory.createSampleJokes(JokeStub.sampleJokes);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<Text>CustomJokes</Text>
|
||||||
|
<Text>{customJokes.displayJoke()}</Text>
|
||||||
|
<Text>SamplesJokes</Text>
|
||||||
|
<Text>{samplesJokes.displayJoke()}</Text>
|
||||||
|
|
||||||
|
<StatusBar style="auto"/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Styles pour le composant
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
export function loadExtensions() {
|
|
||||||
if (!string.prototype.toNounours) {
|
|
||||||
string.prototype.toNounours = function () {
|
|
||||||
return new Nounours(this)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,9 @@
|
|||||||
|
// Fonction pour étendre le prototype d'Array avec une nouvelle méthode print
|
||||||
|
export function loadExtensions() {
|
||||||
|
// Ajout de la méthode print au prototype d'Array
|
||||||
|
if (!Array.prototype.displayJoke) {
|
||||||
|
Array.prototype.displayJoke = function () {
|
||||||
|
return this.map((item) => item.description() + '\n')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
class CustomStub{
|
|
||||||
public Customjoke = '[{type:"type",setup:"setup",image:"image",punchline:"punchline",id:"id"}]'
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
import {SampleJoke} from "./SampleJoke";
|
||||||
|
|
||||||
|
export class JokeStub {
|
||||||
|
// Données JSON pour les CustomJokes
|
||||||
|
public static customJokes = '[{"type":"custom", "setup":"Quel jour les poules ont-elles l anus dilaté au maximum ?", "punchline":"Le jour où elles passent du coq à l âne.", "image":"image1", "id":"id1"}, {"type":"custom", "setup":"Savez-vous comment on appelle le sexe de Michael Jackson ???", "punchline":"Vérité ! Car la vérité sort toujours de la bouche des enfants .", "image":"image2", "id":"id2"}]';
|
||||||
|
|
||||||
|
// Données JSON pour les SampleJokes
|
||||||
|
public static sampleJokes = '[{"type":"sample", "setup":"Que dit un escargot quand il croise une limace ?", "punchline":"Oh la belle décapotable ", "image":"image1", "id":"id1"}, {"type":"sample", "setup":"Qu est ce qui n est pas un steak ?", "punchline":"Une pastèque.", "image":"image2", "id":"id2"}]';
|
||||||
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
class SampleStub{
|
|
||||||
public Customjoke = '[{type:"typeSample",setup:"setupSample",image:"imageSample",punchline:"punchlineSample",id:"idSample"}]'
|
|
||||||
}
|
|
@ -0,0 +1,8 @@
|
|||||||
|
export {}
|
||||||
|
|
||||||
|
// Extension de l'interface globale Array avec une nouvelle méthode print
|
||||||
|
declare global {
|
||||||
|
interface Array<T> {
|
||||||
|
displayJoke(): string[];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue