GithubHelp home page GithubHelp logo

momolly1024 / first-react-native-pj-prac Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 37.23 MB

JavaScript 55.11% Ruby 1.60% Starlark 0.78% Java 20.17% Makefile 1.95% C++ 9.02% Shell 0.72% Objective-C 3.09% Objective-C++ 5.76% Python 1.81%

first-react-native-pj-prac's Introduction

notification

https://blog.openreplay.com/mobile-push-notifications-with-firebase

  • app 背景執行時/關閉 app 時 /開啟 app 時

python(要先取得 APP 的 registration_token 傳給後端,後端再發送?maybe~~)

import firebase_admin
from firebase_admin import credentials
from firebase_admin import messaging
import datetime

cred = credentials.Certificate("./serviceAccountKey.json")
default_app = firebase_admin.initialize_app(credential=cred)
registration_token = ""

messages = [
    messaging.Message(
        notification=messaging.Notification(
            title="qqqqqqqqq",
            body="wwwwwwwwwww",
        ),
        data={
            "screen_name": "RRRR",
            "title": "great match!",
            "body": "PortugalVSDenmark",
        },
        token=registration_token,
    ),
]

response = messaging.send_all(messages)
print("{0} messages were sent successfully".format(response.success_count))

q

reference

step

  • run
npx react-native run-android
  • install pkg

  • fix

npx react-native log-android
@react-navigation/bottom-tabs
@react-navigation/drawer
@react-navigation/material-bottom-tabs
@react-navigation/material-top-tabs
@react-navigation/native
@react-navigation/stack
react-native-gesture-handler
react-native-pager-view
react-native-paper
react-native-reanimated
react-native-safe-area-context
react-native-screens
react-native-vector-icon
@react-native-async-storage/async-storage
  • edit file to import icon pkg app/buildgradle
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

icon docs https://oblador.github.io/react-native-vector-icons/

fetch API

const FetchData = () => {
  const [isLoading, setLoading] = useState(true);
  const [data, setData] = useState([]);
  console.log(data);

  useEffect(() => {
    fetch(
      'https://raw.githubusercontent.com/adhithiravi/React-Hooks-Examples/master/testAPI.json',
    )
      .then(response => response.json())
      .then(json => setData(json))
      .catch(error => console.error(error))
      .finally(() => setLoading(false));
  }, []);
  return (
    <SafeAreaView style={styles.container}>
      {isLoading ? (
        <Text>Loading...</Text>
      ) : (
        <FlatList
          data={data.articles}
          keyExtractor={({id}, index) => id}
          renderItem={({item}) => <Text>{item.id + '. ' + item.title}</Text>}
          ListHeaderComponent={getHeader}
          ListFooterComponent={getFooter}
        />
      )}
    </SafeAreaView>
  );
};

CSS

<Text style={styles.highlight}>App.js</Text>
...
const styles = StyleSheet.create({
  highlight: {
    fontWeight: '700',
  }
});

first-react-native-pj-prac's People

Contributors

momolly1024 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.