Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subindo aplicacao de lanterna desenvolvida em bootcamp DIO
- Loading branch information
1 parent
59b09f1
commit 1ec94dd
Showing
84 changed files
with
11,423 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React, {useState, useEffect} from "react"; | ||
import { View, StyleSheet, Image, TouchableOpacity, Alert } from "react-native"; | ||
import dioLogoBranca from './assets/icons/logo-dio-white.png'; | ||
import dioLogoNormal from './assets/icons/logo-dio.png'; | ||
import Torch from "react-native-torch"; | ||
import RNShake from 'react-native-shake'; | ||
|
||
const App = () => { | ||
const [toggle, settoggle] = useState(false); | ||
|
||
|
||
const handleChangeToggle = () => {settoggle(((oldToggle) => !oldToggle))}; | ||
|
||
|
||
useEffect(() => { | ||
Torch.switchState(toggle); | ||
}, [toggle]); | ||
|
||
useEffect(() => { | ||
|
||
const subscription = RNShake.addListener(() => settoggle(((oldToggle) => !oldToggle))); | ||
|
||
|
||
return () => subscription.remove(); | ||
|
||
}, []) | ||
// modelando os dois jeitos de importar imagens | ||
return <View style={toggle ? style.containerLight : style.container}> | ||
<TouchableOpacity onPress={handleChangeToggle}> | ||
<Image | ||
style = {toggle ? style.litghtingOn : style.litghtingOff } | ||
source= {toggle ? require('./assets/icons/eco-light.png') : require('./assets/icons/eco-light-off.png')} | ||
/> | ||
<Image | ||
style = { style.dioLogo } | ||
source= {toggle ? dioLogoNormal : dioLogoBranca} | ||
/> | ||
</TouchableOpacity> | ||
</View>; | ||
} | ||
|
||
export default App; | ||
|
||
const style = StyleSheet.create({ | ||
container: { | ||
flex:1, | ||
backgroundColor: 'black', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
containerLight: { | ||
flex:1, | ||
backgroundColor: 'white', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
lanternaAcesa: { | ||
resizeMode: 'contain', | ||
alignSelf: 'center', | ||
width: 150, | ||
height: 150 | ||
}, | ||
lanternaDesligada: { | ||
resizeMode: 'contain', | ||
alignSelf: 'center', | ||
width: 150, | ||
height: 150, | ||
tintColor: 'white' | ||
}, | ||
dioLogo: { | ||
resizeMode: 'contain', | ||
alignSelf: 'center', | ||
width: 250, | ||
height: 250, | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version | ||
ruby '2.7.5' | ||
|
||
gem 'cocoapods', '~> 1.11', '>= 1.11.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import 'react-native'; | ||
import React from 'react'; | ||
import App from '../App'; | ||
|
||
// Note: test renderer must be required after react-native. | ||
import renderer from 'react-test-renderer'; | ||
|
||
it('renders correctly', () => { | ||
renderer.create(<App />); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# To learn about Buck see [Docs](https://buckbuild.com/). | ||
# To run your application with Buck: | ||
# - install Buck | ||
# - `npm start` - to start the packager | ||
# - `cd android` | ||
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` | ||
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck | ||
# - `buck install -r android/app` - compile, install and run application | ||
# | ||
|
||
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") | ||
|
||
lib_deps = [] | ||
|
||
create_aar_targets(glob(["libs/*.aar"])) | ||
|
||
create_jar_targets(glob(["libs/*.jar"])) | ||
|
||
android_library( | ||
name = "all-libs", | ||
exported_deps = lib_deps, | ||
) | ||
|
||
android_library( | ||
name = "app-code", | ||
srcs = glob([ | ||
"src/main/java/**/*.java", | ||
]), | ||
deps = [ | ||
":all-libs", | ||
":build_config", | ||
":res", | ||
], | ||
) | ||
|
||
android_build_config( | ||
name = "build_config", | ||
package = "com.dioflashlight", | ||
) | ||
|
||
android_resource( | ||
name = "res", | ||
package = "com.dioflashlight", | ||
res = "src/main/res", | ||
) | ||
|
||
android_binary( | ||
name = "app", | ||
keystore = "//android/keystores:debug", | ||
manifest = "src/main/AndroidManifest.xml", | ||
package_type = "debug", | ||
deps = [ | ||
":app-code", | ||
], | ||
) |
Oops, something went wrong.