Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ proguard/

# Log Files
*.log

.bundle/
.yarn/
6 changes: 0 additions & 6 deletions example/.buckconfig

This file was deleted.

99 changes: 0 additions & 99 deletions example/.flowconfig

This file was deleted.

1 change: 0 additions & 1 deletion example/.gitattributes

This file was deleted.

65 changes: 14 additions & 51 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,55 +1,18 @@
# OSX
#
*.binlog
*.hprof
*.xcworkspace/
*.zip
.DS_Store

# Xcode
#
.bundle/*
!.bundle/config
.gradle/
.idea/
.vs/
.xcode.env
Pods/
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
dist/*
!dist/.gitignore
local.properties
*.iml

# node.js
#
msbuild.binlog
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots

# CocoaPods
/ios/Pods/
2 changes: 1 addition & 1 deletion example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
154 changes: 154 additions & 0 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/

import { NewAppScreen } from "@react-native/new-app-screen";
import {
StatusBar,
StyleSheet,
Text,
TouchableOpacity,
useColorScheme,
View,
} from "react-native";
import Snackbar from "react-native-snackbar";
import styles from "./styles";

function App() {
const isDarkMode = useColorScheme() === "dark";

return (
<View style={styles.container}>
<Text style={styles.title}>Snackbar Examples</Text>

<TouchableOpacity
onPress={() => Snackbar.show({ text: "Hello, World!" })}
>
<Text style={styles.button}>Simple Snackbar</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Hello, World!",
textAlignCenter: true,
})
}
>
<Text style={styles.button}>Align text center</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Hello, World! How are you doing today? Enjoying the sun?! This should wrap to two lines.",
duration: Snackbar.LENGTH_LONG,
})
}
>
<Text style={styles.button}>Simple Snackbar - two lines</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
duration: Snackbar.LENGTH_LONG,
numberOfLines: 5,
})
}
>
<Text style={styles.button}>Simple Snackbar - extra lines</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Please agree to this.",
duration: Snackbar.LENGTH_INDEFINITE,
action: {
text: "AGREE",
textColor: "green",
onPress: () => Snackbar.show({ text: "Thank you!" }),
},
})
}
>
<Text style={styles.button}>Snackbar with action</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Please agree to this.",
duration: Snackbar.LENGTH_INDEFINITE,
textColor: "blue",
backgroundColor: "silver",
fontFamily: "Lobster-Regular",
action: {
text: "AGREE",
textColor: "blue",
onPress: () => Snackbar.show({ text: "Thank you!" }),
},
})
}
>
<Text style={styles.button}>Snackbar with style</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "يرجى الموافقة على هذا.",
rtl: true,
duration: Snackbar.LENGTH_INDEFINITE,
action: {
text: "يوافق على",
textColor: "green",
onPress: () => Snackbar.show({ text: "شكرا لكم!", rtl: true }),
},
})
}
>
<Text style={styles.button}>Snackbar with RTL text</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Use a bottom margin to avoid covering navigational elements such as a tab bar.",
marginBottom: 500,
})
}
>
<Text style={styles.button}>Snackbar with bottom margin</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Use a bottom margin to avoid covering navigational elements such as a tab bar.",
marginHorizontal: 100,
})
}
>
<Text style={styles.button}>Snackbar with horizontal margin</Text>
</TouchableOpacity>

<TouchableOpacity onPress={() => Snackbar.dismiss()}>
<Text style={styles.button}>Dismiss active Snackbar</Text>
</TouchableOpacity>
</View>
);
}

// const styles = StyleSheet.create({
// container: {
// flex: 1,
// },
// });

export default App;
16 changes: 16 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'

# Ruby 3.4.0 has removed some libraries from the standard library.
gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
Loading