Skip to content

Commit

Permalink
Merge branch 'main' of github.com:birkir/react-native-sfsymbols into …
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
birkir committed Oct 4, 2021
2 parents 58c5757 + 551a2e5 commit 086a2b5
Show file tree
Hide file tree
Showing 72 changed files with 11,751 additions and 1,360 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules
example/
lib/
12 changes: 5 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
"@react-native-community",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off"
"no-shadow": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-shadow": ["error"]
}
}
80 changes: 62 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Use SF Symbols in React Native for iOS
- ⚠️ iOS 14+ only ([& more soon](https://github.com/birkir/react-native-sfsymbols/issues/1))
- 💔 [Android or other platforms cannot be supported](https://github.com/birkir/react-native-sfsymbols/issues/3)

![iOS Simulator with icons example](https://media.giphy.com/media/5gB4qLjkuYwVn10O77/giphy.gif)
![iOS Simulator with icons example](https://media.giphy.com/media/5gB4qLjkuYwVn10O77/giphy.gif) ![Example app](https://i.ibb.co/F03LBxj/Simulator-Screen-Shot-i-Phone-12-2021-06-23-at-11-47-54.png)

## Setup

Expand Down Expand Up @@ -33,20 +33,18 @@ _Don't forget to run `cd ios && pod install && cd ..` after that !_
## Usage

```jsx
import {
SFSymbol,
SFSymbolWeight,
SFSymbolScale,
} from "react-native-sfsymbols";
import { SFSymbol } from "react-native-sfsymbols";

export function Example() {
return (
<SFSymbol
name="thermometer.sun.fill"
weight={SFSymbolWeight.SEMIBOLD}
scale={SFSymbolScale.LARGE}
weight="semibold"
scale="large"
color="red"
multicolor={true | false}
size={16}
resizeMode="center"
multicolor={false}
style={{ width: 32, height: 32 }}
/>
);
Expand All @@ -73,20 +71,66 @@ const AnimatedSFSymbol = Animated.createAnimatedComponent(SFSymbol);

### name

The symbol name you want to display, can be seen in the SF Symbols application.
The symbol name you want to display, can be seen in the [SF Symbols application](https://developer.apple.com/sf-symbols/).

### color (optional)

The color of the symbol written as a hex or color value. PlatformColor and DynamicColorIOS also works.

### weight (optional)

## color
The (font) weight of the symbol.

The color of the symbol written as a hex or color value.
```
ultralight
light
thin
regular
medium
semibold
bold
heavy
```

### weight
Multicolor has issues with this "thin" weight.

The (font) weight of the symbol. Light, regular, medium, bold, etc.
### scale (optional)

### scale
The scale of the symbol, it will optimise the thickness of detail strokes in the icon for different sizes.

The scale of the symbol, it will optimise the thickness of detail strokes in the icon for different sizes. Currently small, medium and large.
```
small
medium
large
```

### multicolor
### multicolor (optional)

Enable multicolor or not. Seems to only work with 14.2, and only some symbols.
Enable multicolor, don't pass a "color" for it to work properly.

### size (optional)

Font size of the icon as a number.

### resizeMode (optional)

Resize mode of the icon. When "size" is given, it will default to "center" otherwise "scale-aspect-fill".

```
scale-to-fill
scale-aspect-fit
scale-aspect-fill
redraw
center
top
bottom
left
right
top-left
top-right
bottom-left
bottom-right
cover
contain
stretch
```
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
};
6 changes: 6 additions & 0 deletions example/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
4 changes: 4 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
3 changes: 3 additions & 0 deletions example/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Windows files should use crlf line endings
# https://help.github.com/articles/dealing-with-line-endings/
*.bat text eol=crlf
59 changes: 59 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

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

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

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# 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://docs.fastlane.tools/best-practices/source-control/

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

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/
7 changes: 7 additions & 0 deletions example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
};
1 change: 1 addition & 0 deletions example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
14 changes: 14 additions & 0 deletions example/__tests__/App-test.tsx
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 />);
});
3 changes: 3 additions & 0 deletions example/_editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Windows files
[*.bat]
end_of_line = crlf
55 changes: 55 additions & 0 deletions example/android/app/_BUCK
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.example",
)

android_resource(
name = "res",
package = "com.example",
res = "src/main/res",
)

android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)
Loading

0 comments on commit 086a2b5

Please sign in to comment.