-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added possibility to change between app mode and storybook app mode #29
The head ref may contain hidden characters: "JUIP-133-a\u00F1adir-posibilidad-de-intercambiar-entre-storybook-y-app"
Changes from 2 commits
46faf32
5cb18ef
389a92f
f707604
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LOAD_STORYBOOK=true | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,7 @@ dist/ | |
|
||
# Static storybook page | ||
.storybook_static | ||
.docs | ||
.docs | ||
|
||
# .env | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aca sería meter al env.json |
||
.env |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
apply plugin: "com.android.application" | ||
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aca deberías de volar esta linea |
||
|
||
import com.android.build.OutputFile | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ import {AppRegistry} from 'react-native'; | |
import App from './App'; | ||
import {name as appName} from './app.json'; | ||
import Storybook from './storybook'; | ||
import Config from 'react-native-config'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aca es donde te importas la key que vos necesitas, pero de env.json |
||
|
||
const Component = __DEV__ ? Storybook : App; | ||
const Component = Config.LOAD_STORYBOOK === 'true' ? Storybook : App; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOAD_STORYBOOK ya es un booleano, es redundante compararlo con true. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilliamSaya-lvl30 parece que es un booleano pero en realidad es un string, ya estuve buscando y no está soportado por la librería el parsearlo a booleano, habría que instalar una librería para hacerlo cómo muestran acá: lugg/react-native-config#49 (comment), pero mepa que no va porque lo vamos a usar ahí sólo |
||
|
||
AppRegistry.registerComponent(appName, () => Component); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const fs = require('fs'); | ||
|
||
const mode = process.argv[2]; | ||
|
||
const modes = { | ||
app: 0, | ||
storybook: 1, | ||
}; | ||
|
||
fs.writeFileSync('.env', `LOAD_STORYBOOK=${!!modes[mode]}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nico, para no depender de la librería de rn config, aca lo que te conviene hacer es crear un archivo que en vez de .env, se llame env.json, donde setees la key LOAD_STORYBOOK. Entonces cuando queres levantarla, la levantas desde ese archivo, como hacemos en las apps, fijate que al correr cada ambiente (beta, qa y master), setteamos un env json distinto. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
este archivo de .env, vuela