This file contains hidden or 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
| POST https://api.github.com/repos/{user}/{repo}/git/trees |
This file contains hidden or 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
| const createGithubFileBlob = async ( | |
| githubAccessToken, | |
| repoFullName, | |
| content, | |
| encoding = "utf-8" | |
| ) => { | |
| const blobResp = await fetch( | |
| `https://api.github.com/repos/${repoFullName}/git/blobs`, | |
| { | |
| method: "POST", |
This file contains hidden or 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
| POST https://api.github.com/repos/{user}/{repo}/git/blobs |
This file contains hidden or 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
| const getShaForBaseTree = async ( | |
| githubAccessToken, | |
| repoFullName, | |
| branchName | |
| ) => { | |
| const baseTreeResp = await fetch( | |
| `https://api.github.com/repos/${repoFullName}/git/trees/${branchName}`, | |
| { | |
| method: "GET", | |
| headers: { |
This file contains hidden or 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
| GET https://api.github.com/repos/{user}/{repo}/git/trees/{branch} |
This file contains hidden or 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
| const articleFiles = [ | |
| { | |
| path: "/my-new-website/index.html", | |
| content: "Hello World!", | |
| encoding: "utf-8", | |
| }, | |
| { | |
| path: "/my-new-website/images/logo.png", | |
| content: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQ", | |
| encoding: "base64", |
This file contains hidden or 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
| const createGithubFileBlob = async (githubAccessToken, repoFullName, content, encoding = "utf-8") => { | |
| const blobResp = await fetch(`https://api.github.com/repos/${repoFullName}/git/blobs`, | |
| { | |
| method: 'POST', | |
| headers: { | |
| 'Accept': 'application/vnd.github+json', | |
| 'Authorization': `Bearer ${githubAccessToken}`, | |
| 'X-GitHub-Api-Version': '2022-11-28' | |
| }, | |
| body: JSON.stringify({ |
This file contains hidden or 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
| import { useRef } from "react"; | |
| import { View, Button } from "react-native"; | |
| import ViewShot from "react-native-view-shot"; | |
| import Share from "react-native-share"; | |
| import RNFS from "react-native-fs"; | |
| export default function MorgageCalculatorSummary() { | |
| const ref = useRef(); | |
| const captureAndShareScreenshot = () => { |
This file contains hidden or 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
| // add following imports at the top | |
| import Share from "react-native-share"; | |
| import RNFS from "react-native-fs"; | |
| const captureAndShareScreenshot = () => { | |
| if (!ref || !ref.current) { | |
| return; | |
| } | |
| ref.current.capture().then((uri: any) => { | |
| RNFS.readFile(uri, "base64").then((res) => { |
This file contains hidden or 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
| import { useRef } from "react"; | |
| import { View, Button } from "react-native"; | |
| import ViewShot from "react-native-view-shot"; | |
| export default function MyCustomComponent() { | |
| const ref = useRef(); | |
| return ( | |
| <Box> | |
| <Button |