Remove old ReactNative implementation (#8946)

* Remove old ReactNative implementation

This stuff has been spun out to https://github.com/Bigthinkcode/AdaptiveCards/

* Delete github workflow as well...
This commit is contained in:
Paul Campbell 2024-06-28 15:09:24 -07:00 коммит произвёл GitHub
Родитель 59dad361ab
Коммит 97c1d579fb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
329 изменённых файлов: 0 добавлений и 60107 удалений

24
.github/workflows/react-native-build.yml поставляемый
Просмотреть файл

@ -1,24 +0,0 @@
# This workflow will install npm dependencies and run tests
name: react-native-build
on:
pull_request:
branches: [ master, main ]
paths:
- 'source/community/reactnative/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install dependencies
working-directory: ./source/community/reactnative
run: npm install
- name: Run test
working-directory: ./source/community/reactnative
run: npm test

Просмотреть файл

@ -1,4 +0,0 @@
module.exports = {
root: true,
extends: '@react-native-community',
};

Просмотреть файл

@ -1,74 +0,0 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
[include]
[libs]
node_modules/react-native/interface.js
node_modules/react-native/flow/
[options]
emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
munge_underscores=true
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[version]
^0.122.0

2
source/community/reactnative/.gitattributes поставляемый
Просмотреть файл

@ -1,2 +0,0 @@
# specific for windows script files
*.bat text eol=crlf

Просмотреть файл

@ -1,26 +0,0 @@
# This workflow will install npm dependencies and run tests
name: react-native-build
on:
push:
branches: [ reactnative/release-2.2-tests ]
paths:
- 'source/community/reactnative/**'
pull_request:
branches: [ reactnative/release-2.2 ]
paths:
- 'source/community/reactnative/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
cd source/community/reactnative/
sudo rm -rf node_modules
npm install
- name: Test with jest
run: |
npm test

69
source/community/reactnative/.gitignore поставляемый
Просмотреть файл

@ -1,69 +0,0 @@
# 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
!build.gradle
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
ios/Pods/
ios/Podfile.lock
# 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
# VSCode
.vscode

Просмотреть файл

@ -1,6 +0,0 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};

Двоичные данные
source/community/reactnative/AdaptiveCards.gif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 498 KiB

Просмотреть файл

@ -1,38 +0,0 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import {
StyleSheet,
View,
Platform
} from 'react-native';
import Visualizer from './src/visualizer/visualizer';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Visualizer />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
padding: 10,
...Platform.select({
ios: {
paddingTop: 50,
}
})
}
});

Просмотреть файл

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2021 BigThinkCode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -1,217 +0,0 @@
![](AdaptiveCards.gif)
## Usage
- Add package
``` javascript
npm install adaptivecards-reactnative
```
- Import the root component
``` javascript
import AdaptiveCard from 'adaptivecards-reactnative'
```
- Render the component with required props
``` html
<AdaptiveCard payload={}
hostConfig={}
themeConfig={}
onExecuteAction={}
onParseError={}
containerStyle={{
width:100,
height: 100,
flexGrow:1,
backgroundColor:'lightblue'
}}
contentContainerStyle={{
flexGrow: 1,
justifyContent: 'space-between'
}}
cardScrollEnabled={false}
contentHeight={500}
ref="referenceVariable"/>
```
Prop | Type | Description | Required
------------ | ------------- | ------------ | ------------ |
**payload** | `{object}` | JSON payload adhering to the [schema](https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema) | YES
**hostConfig** | `{object}` | JSON Host config to override based on [schema](https://docs.microsoft.com/en-us/adaptive-cards/rendering-cards/host-config) | NO
**themeConfig** | `{object}` | JSON Theme Config to customize styles | NO
**onExecuteAction** | `{Event Handler}` | Method to be executed on card actions | NO
**onParseError** | `{Event Handler}` | Method to be executed on JSON parse errors | NO
**containerStyle** | `{object}` | Style used to override the adaptive card container style | NO
**contentContainerStyle** | `{object}` | Style used to override the adaptive card content container style | NO
**contentHeight** | `{number}` | Value used to override the adaptive card height | NO
**cardScrollEnabled** | `{bool}` | Value used to enable the adaptive card Scroll | NO
**ref** | `React.createRef()` | Reference variable used to invoke the methods exposed by AdaptiveCards.(Example: In order to fetch the image & media URLs across the payload, one can use like this `this.refs.referenceVariable.getResourceInformation()` | NO
## Extensibility
In order to override the rendering of built-in components OR to add/remove an element type, one can simply make use of the functions exposed by Element Registry.
**Examples**
* To override built-in `TextBlock` element,
```
Registry.getManager().registerComponent('TextBlock',CustomTextBlock);
```
* To add support for new element type say `Rating`, add the component in the registry as below :
```
Registry.getManager().registerComponent('Rating',RatingComponent);
```
* To remove the support of an element type (i.e To ignore the rendering of specific element type),
```
Registry.getManager().removeComponent('Input.Date');
```
## DataBinding
The [adaptivecards-templating](https://www.npmjs.com/package/adaptivecards-templating) library is used for DataBinding.
[![Version](https://img.shields.io/npm/v/adaptivecards-templating.svg)](https://www.npmjs.com/package/adaptivecards-templating)
**Breaking Change**
*adaptivecards-reactnative v2.2+ uses *adaptivecards-templating v1.0.0-rc.0* which migrated from older data binding [syntax](https://docs.microsoft.com/en-us/adaptive-cards/templating/#breaking-changes-as-of-may-2020) to [Adaptive Expression Language](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-adaptive-expressions?view=azure-bot-service-4.0).
So data-binding for older templates will not work in adaptivecards-reactnative v2.2+
**Usage**
```jsx
import AdaptiveCard from '../adaptive-card';
import * as ACData from 'adaptivecards-templating';
// Sample template payload
var templatePayload = {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "2.0",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Hi {employee.name}! Here's a bit about your organisation"
},
{
"type": "TextBlock",
"text": "Your manager is: {employee.manager.name}"
},
{
"type": "TextBlock",
"text": "2 of your peers are: {employee.peers[0].name}, {employee.peers[1].name}"
}
]
};
// Create a Template instance from the template payload
var template = new ACData.Template(templatePayload);
// Create a data binding context, and set its $root property to the
// data object to bind the template to
var context = {
"$root": {
"employee": {
"name": "David Claux",
"manager": {
"name": "Matt Hidinger"
},
"peers": [
{
"name": "Andrew Leader"
},
{
"name": "Shalini Joshi"
}
]
}
}
}
// "Expand" the template - this generates the final payload for the Adaptive Card,
templatePayload = template.expand(context);
//Render the adaptive card with templatePayload
<AdaptiveCard payload={templatePayload}/>
```
## Theme Config
* For customizing UI styles of elements, Host App can pass styles (plain JSON object) as an optional prop to root element `<AdaptiveCards/>`.
* Currently below elements are supported in the theme config.
* input
* button
* choice Set
* date picker
* time picker
* Host app can provide `platform specific styles` as seen in the below example. For same styles across platforms, pass the styles without platform.
**Examples**
In this example, styles passed for element `input` are applied to all the platforms whereas for `button` platform-specific styles are applied.
```css
customThemeConfig = {
input: {
borderColor: "#000000",
backgroundColor: "#F5F5F5",
borderRadius: 4,
borderWidth: 1,
},
button: {
"ios": {
color: 'white',
backgroundColor: "#1D9BF6",
},
"android": {
color: 'white',
backgroundColor: "#1D9BF6",
},
"windows": {
color: 'white',
backgroundColor: "#1D9BF6",
}
}
}
<AdaptiveCards themeConfig={customThemeConfig} payload={payload} />
```
Refer this [wiki page](https://github.com/microsoft/AdaptiveCards/wiki/React-Native-Theme-Config-Support) to view the complete list of customizable theme config properties.
## Examples / Visualizer
There are lot of sample JSON payloads covering all element types with few real case scenarios are available within this project.
To see the visualizer,
* Clone the repo https://github.com/microsoft/AdaptiveCards
* Navigate to `source/community/reactnative/` **>** Run **`npm install`**
* iOS **> `react-native run-ios`**
* Android **> `react-native run-android`**
* Windows **> `react-native start`** and **`Launch Simulator from Visual Studio`**
**Notes:** Follow https://github.com/Microsoft/react-native-windows/blob/main/RNWCS/docs/GettingStarted.md for react-native-windows setup
## About Adaptive Card
* Collection of `elements` and `actions`
* Element is the basic `building block` of card
* Element can be a `standalone` component OR can be a `container` that in turn holds collection of other element types
* Main responsibilities of an element are,
* **P**arsing
* **R**endering
* `HostConfig` takes care of applying `default styles`. Custom styles (if any) can also be passed via HostConfig instance
* `Actions` area contains one or more action buttons
## Project Structure
This project is for React-Native implementation of Adaptive cards based on https://github.com/Microsoft/AdaptiveCards.
A Quick overview of the folder structure.
* Components
* Utils
* Styles
Folder | Description
------------ | -------------
**`src/components`** | This directory contains all the components along with its registry functionalities. This includes standalone components, container types and actions.
**`src/components/actions`** | This directory holds the collection of action elements.
**`src/components/containers`** | This directory holds the container elements that holds collection of elements and its layout.
**`src/components/elements`** | This directory holds all the static individual elements
**`src/components/inputs/`** | This directory holds all the interactable input elements
**`src/utils`** | This directory takes care of keeping the Configuration out of the Code. This will hold anything that is used in multiple places throughout our app in one place.
**`src/styles`** | This directory holds the global styles that will be used and applied across the components and app.The purpose is that we will reuse a lot of the same styling(like Container, Themes,etc....).

Просмотреть файл

@ -1,108 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
<View
onLayout={[Function]}
style={
Object {
"paddingBottom": 0,
}
}
>
<View
style={
Array [
Array [
Object {
"justifyContent": "flex-start",
},
Object {
"backgroundColor": "transparent",
},
Object {
"backgroundColor": "transparent",
},
Object {
"borderColor": undefined,
"borderWidth": 0,
},
Object {
"padding": 5,
},
],
Array [
Object {
"padding": 10,
},
],
]
}
>
<RCTScrollView
alwaysBounceHorizontal={false}
alwaysBounceVertical={false}
scrollEnabled={true}
showsHorizontalScrollIndicator={true}
showsVerticalScrollIndicator={true}
>
<View>
<View
style={
Array [
Object {
"backgroundColor": "transparent",
},
Object {
"alignItems": "center",
"backgroundColor": "transparent",
"width": "100%",
},
]
}
>
<Text
numberOfLines={1}
style={
Array [
Object {
"color": "#333333",
"fontFamily": "Helvetica",
"fontSize": 14,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {
"width": "100%",
},
undefined,
],
]
}
>
Adaptive Card Test
</Text>
</View>
<View>
<View
style={
Array [
Object {
"flexWrap": "wrap",
"paddingTop": 10,
},
Object {
"flexDirection": "row",
},
Object {
"justifyContent": "flex-start",
},
]
}
/>
</View>
</View>
</RCTScrollView>
</View>
</View>
`;

Просмотреть файл

@ -1,21 +0,0 @@
import 'react-native';
import React from 'react';
import renderer from 'react-test-renderer';
import AdaptiveCard from '../src/adaptive-card'
it('renders correctly', () => {
const tree = renderer.create(
<AdaptiveCard payload={{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "Adaptive Card Test"
}
]
}}/>
).toJSON();
expect(tree).toMatchSnapshot();
});

Просмотреть файл

@ -1,65 +0,0 @@
# 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
#
lib_deps = []
for jarfile in glob(['libs/*.jar']):
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
lib_deps.append(':' + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)
for aarfile in glob(['libs/*.aar']):
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
lib_deps.append(':' + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
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.rnadaptivecards",
)
android_resource(
name = "res",
package = "com.rnadaptivecards",
res = "src/main/res",
)
android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)

Просмотреть файл

@ -1,225 +0,0 @@
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://reactnative.dev/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
defaultConfig {
applicationId "com.rnadaptivecards"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
config {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
debug {
signingConfig signingConfigs.config
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.config
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Просмотреть файл

@ -1,10 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:

Просмотреть файл

@ -1,27 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rnadaptivecards">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>

Просмотреть файл

@ -1,15 +0,0 @@
package com.rnadaptivecards;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "RNAdaptiveCards";
}
}

Просмотреть файл

@ -1,81 +0,0 @@
package com.rnadaptivecards;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.rnadaptivecards.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 61 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 14 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 41 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.0 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.3 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 9.0 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 15 KiB

Просмотреть файл

@ -1,3 +0,0 @@
<resources>
<string name="app_name">RNAdaptiveCards</string>
</resources>

Просмотреть файл

@ -1,9 +0,0 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
</resources>

Просмотреть файл

@ -1,44 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:4.1.2')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
wrapper() {
gradleVersion = '4.4'
distributionUrl = distributionUrl.replace("bin", "all")
}

Просмотреть файл

@ -1,28 +0,0 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.74.0

Двоичные данные
source/community/reactnative/android/gradle/wrapper/gradle-wrapper.jar поставляемый

Двоичный файл не отображается.

Просмотреть файл

@ -1,6 +0,0 @@
#Tue Feb 23 12:10:47 IST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

167
source/community/reactnative/android/gradlew поставляемый
Просмотреть файл

@ -1,167 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

Просмотреть файл

@ -1,103 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,4 +0,0 @@
rootProject.name = 'RNAdaptiveCards'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
include ':app'

Просмотреть файл

@ -1,4 +0,0 @@
{
"name": "RNAdaptiveCards",
"displayName": "RNAdaptiveCards"
}

Просмотреть файл

@ -1,7 +0,0 @@
module.exports = (api) => {
api.cache(true)
return {
presets: ['module:metro-react-native-babel-preset']
}
}

Просмотреть файл

@ -1,196 +0,0 @@
import * as Constants from './constants';
/**
* @description - This builder creates adaptive card from `HeroCard` / `ThumbnailCard` .
* @param cardContent - Content of the card to be converted
* @param type - Type of the card.
*/
export const buildAdaptiveCard = (cardContent, type) => {
const AdaptiveCard = {
"type": Constants.TypeAdaptiveCard,
"version": Constants.AdaptiveCardVersion,
"body": [],
"actions": []
}
const ColumnSet = {
"type": Constants.TypeColumnSet,
"columns": [
{
"type": Constants.TypeColumn,
"width": Constants.ThumbNailWidth,
"items": []
},
{
"type": Constants.TypeColumn,
"width": Constants.WidthStretch,
"items": []
}
]
}
if (cardContent && type) {
switch (type) {
case Constants.TypeHeroCard:
pushTextBlocks(cardContent, AdaptiveCard.body);
pushImages(cardContent, AdaptiveCard.body);
pushActions(cardContent, AdaptiveCard.actions);
break;
case Constants.TypeThumbnailCard:
pushImages(cardContent, ColumnSet.columns[0].items);
pushTextBlocks(cardContent, ColumnSet.columns[1].items);
pushActions(cardContent, ColumnSet.columns[1].items, true);
AdaptiveCard.body.push(ColumnSet);
delete AdaptiveCard.actions;
break;
default:
elementsContainer = [];
break;
}
/**
* `tap` to container `selectAction`
*/
if (cardContent.tap && cardContent.tap.type && cardContent.tap.value) {
const body = AdaptiveCard.body;
AdaptiveCard.body = [];
const containerBody = {};
containerBody.type = Constants.TypeContainer;
containerBody.items = body;
containerBody.selectAction = cardAction(cardContent.tap);
AdaptiveCard.body[0] = containerBody;
}
}
return AdaptiveCard;
}
/**
* @description - This method pushes text blocks to the adaptive card container.
* @param cardContent - Content of the card to be converted.
* @param textBlockContainer - Container where the tex blocks to be inserted
*/
pushTextBlocks = (cardContent, textBlockContainer) => {
if (isNotEmpty(cardContent.title))
textBlockContainer.push(textBlock(cardContent.title, Constants.TypeTitle));
if (isNotEmpty(cardContent.subtitle))
textBlockContainer.push(textBlock(cardContent.subtitle, Constants.TypeSubTitle));
if (isNotEmpty(cardContent.text))
textBlockContainer.push(textBlock(cardContent.text));
return textBlockContainer;
}
/**
* @description - This method pushes images to the adaptive card container.
* @param cardContent - Content of the card to be converted.
* @param imageContainer - Container where the images to be inserted
*/
pushImages = (cardContent, imageContainer) => {
if (cardContent.images && cardContent.images.length > 0) {
cardContent.images.forEach(image => {
imageContainer.push(cardImage(image));
})
}
}
/**
* @description - This method pushes actions to the adaptive card container.
* @param cardContent - Content of the card to be converted.
* @param actionContainer - Container where the actions to be inserted
* @param isNested - A boolean decides where the actions need to be added in the container
*/
pushActions = (cardContent, actionContainer, isNested) => {
if (cardContent.buttons && cardContent.buttons.length > 0) {
if (!isNested) {
cardContent.buttons.forEach(button => {
actionContainer.push(cardAction(button));
})
} else {
const nestedContainer = {
"type": Constants.TypeColumnSet
}
const columns = [];
cardContent.buttons.forEach(button => {
const column = {
"type": Constants.TypeColumn,
"items": []
};
column.items.push(cardAction(button));
columns.push(column);
})
nestedContainer.columns = columns;
actionContainer.push(nestedContainer);;
}
}
}
/**
* @description - Convert card types `title, subtitle and text` to Adaptive card type format.
* @param content - The content to be displayed
* @param type - Element type to be converted.
*/
textBlock = (content, type) => {
const textBlock = {};
textBlock.type = Constants.TypeTextBlock;
textBlock.text = content;
switch (type) {
case Constants.TypeTitle:
textBlock.size = Constants.SizeMedium;
textBlock.weight = Constants.WeightBold;
break;
case Constants.TypeSubTitle:
textBlock.isSubtle = true;
textBlock.wrap = true;
break;
default:
textBlock.wrap = true;
break;
}
return textBlock;
}
/**
* @description - Convert `button` to `actions`
* @param button - button content.
*/
cardAction = (button) => {
const action = Object.assign({}, button);
if (button.type === Constants.TypeOpenUrl) {
action.type = Constants.ActionOpenUrl;
action.url = button.value;
} else {
action.data = {
"type": button.type,
"data": button.value
};
action.type = Constants.ActionSubmit;
}
delete action.value;
return action;
}
/**
* @description - Format `image` properties to adaptive card format
* @param image - image content.
*/
cardImage = (image) => {
const cardImage = Object.assign({}, image);
cardImage.type = Constants.ImageType;
cardImage.size = Constants.ImageSize;
if (image.tap) {
cardImage.selectAction = cardAction(image.tap);
delete cardImage.tap;
}
return cardImage;
}
/**
* @description - Checks whether a given value is empty or not.
* @param param - param need to be checked.
*/
isNotEmpty = (param) => {
return param && param !== Constants.EmptyString && param.length > 0;
}

Просмотреть файл

@ -1,25 +0,0 @@
## Description
This module uses our [AdaptiveCards renderer package](https://www.npmjs.com/package/adaptivecards-reactnative) and a mapper to support card types other than AdaptiveCards. Here we map the payloads of MS cards such as HeroCard, ThumbnailCard, etc to Adaptive card payload format.
## Supported Cards
As of now, this mapper supports below types of cards.
* [ Hero Card ](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/cards/cards-reference#example-hero-card)
* [ Thumbnail Card](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/cards/cards-reference#thumbnail-card)
## Payload Mapper
The payload mapper file `AdaptiveCardBuilder.js` builds the payload for AdaptiveCard from any HeroCard/ThumbnailCard payload content.
## Test
Follow the below steps to run the sample project in local machine.
* Clone the Repo `https://github.com/microsoft/AdaptiveCards.git`
* Navigate to source/reactnative/ **>** Run **`npm install`**
* iOS **> `react-native run-ios`**
* Android **> `react-native run-android`**
* Click on **`Other Cards`** section

Просмотреть файл

@ -1,32 +0,0 @@
export const TypeAdaptiveCard = "AdaptiveCard";
export const AdaptiveCardVersion = "1.2";
export const TypeHeroCard = "application/vnd.microsoft.card.hero";
export const TypeThumbnailCard = "application/vnd.microsoft.card.thumbnail";
export const EmptyString = "";
export const FullWidth = '100%';
export const CenterString = "center";
export const ActionOpenUrl = "Action.OpenUrl";
export const ActionSubmit = "Action.Submit";
export const TypeOpenUrl = "openUrl";
export const ImageType = "Image";
export const ImageSize = "auto";
export const TypeTextBlock = "TextBlock";
export const TypeTitle = "Title";
export const TypeSubTitle = "SubTitle";
export const TypeContainer = "Container";
export const TypeColumnSet = "ColumnSet";
export const TypeColumn = "Column";
export const SizeMedium = "medium";
export const WeightBold = "bold";
export const ThumbNailWidth = "100px";
export const WidthStretch = "stretch";

Просмотреть файл

@ -1,23 +0,0 @@
{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "Seattle Center Monorail",
"images": [
{
"url":"https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg"
}
],
"buttons": [
{
"type": "openUrl",
"title": "Official website",
"value": "https://www.seattlemonorail.com"
},
{
"type": "Imback",
"title": "Okay",
"value": "Test Okay"
}
]
}
}

Просмотреть файл

@ -1,30 +0,0 @@
{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "Seattle Center Monorail",
"subtitle": "Seattle Center Monorail",
"text": "The Seattle Center Monorail is an elevated train line between Seattle Center (near the Space Needle) and downtown Seattle. It was built for the 1962 World's Fair. Its original two trains, completed in 1961, are still in service.",
"images": [
{
"url":"https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg"
}
],
"buttons": [
{
"type": "openUrl",
"title": "Official website",
"value": "https://www.seattlemonorail.com"
},
{
"type": "openUrl",
"title": "Wikipeda page",
"value": "https://en.wikipedia.org/wiki/Seattle_Center_Monorail"
}
],
"tap" :{
"type": "Submit",
"title": "Official website",
"value": "It's a Container Select Action"
}
}
}

Просмотреть файл

@ -1,27 +0,0 @@
{
"contentType": "application/vnd.microsoft.card.thumbnail",
"content": {
"title": "Bender",
"text": "Bender Bending Rodríguez is a main character in the animated television series Futurama. He was created by series creators Matt Groening and David X. Cohen, and is voiced by John DiMaggio",
"images": [
{
"url": "https://upload.wikimedia.org/wikipedia/en/a/a6/Bender_Rodriguez.png",
"alt": "Bender Rodríguez"
}
],
"buttons": [
{
"type": "imBack",
"title": "Thumbs Up",
"image": "http://moopz.com/assets_c/2012/06/emoji-thumbs-up-150-thumb-autox125-140616.jpg",
"value": "I like it"
},
{
"type": "imBack",
"title": "Thumbs Down",
"image": "http://yourfaceisstupid.com/wp-content/uploads/2014/08/thumbs-down.png",
"value": "I don't like it"
}
]
}
}

Просмотреть файл

@ -1,32 +0,0 @@
{
"contentType": "application/vnd.microsoft.card.thumbnail",
"content": {
"title": "Bender",
"subtitle": "Tale of a robot who dared to love.",
"text": "Bender Bending Rodríguez is a main character in the animated television series Futurama. He was created by series creators Matt Groening and David X. Cohen, and is voiced by John DiMaggio",
"images": [
{
"url": "https://upload.wikimedia.org/wikipedia/en/a/a6/Bender_Rodriguez.png",
"alt": "Bender Rodríguez"
}
],
"buttons": [
{
"type": "imBack",
"title": "Thumbs Up",
"image": "http://moopz.com/assets_c/2012/06/emoji-thumbs-up-150-thumb-autox125-140616.jpg",
"value": "I like it"
},
{
"type": "imBack",
"title": "Thumbs Down",
"image": "http://yourfaceisstupid.com/wp-content/uploads/2014/08/thumbs-down.png",
"value": "I don't like it"
}
],
"tap": {
"type": "imBack",
"value": "Tapped it!"
}
}
}

Просмотреть файл

@ -1,18 +0,0 @@
export default payloads = [
{
"title": "Hero card with all props",
"json": require('./Hero.Card.json')
},
{
"title": "Hero card",
"json": require('./Hero.Card.2.json')
},
{
"title": "Thumbnail card with all props",
"json": require('./Thumbnail.card.json')
},
{
"title": "Thumbnail card",
"json": require('./Thumbnail.card.2.json')
}
]

Просмотреть файл

@ -1,9 +0,0 @@
/** @format */
import { AppRegistry, Platform } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import { name as windowsapp } from './windows.json';
AppRegistry.registerComponent(Platform.OS === 'windows' ? windowsapp : appName, () => App);

Просмотреть файл

@ -1,32 +0,0 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'RNAdaptiveCards' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'RNAdaptiveCardsTests' do
inherit! :complete
# Pods for testing
end
# For enabling Flipper.
# Note that if you use_framework!, flipper will not work.
# Disable these lines if you are doing use_framework!
use_flipper!({ 'Flipper-Folly' => '2.3.0' }) # update this part
post_install do |installer|
flipper_post_install(installer)
end
end
target 'RNAdaptiveCards-tvOS' do
# Pods for RNAdaptiveCards-tvOS
target 'RNAdaptiveCards-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end

Просмотреть файл

@ -1,484 +0,0 @@
PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.5)
- CocoaLibEvent (1.0.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.63.4)
- FBReactNativeSpec (0.63.4):
- Folly (= 2020.01.13.00)
- RCTRequired (= 0.63.4)
- RCTTypeSafety (= 0.63.4)
- React-Core (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- Flipper (0.54.0):
- Flipper-Folly (~> 2.2)
- Flipper-RSocket (~> 1.1)
- Flipper-DoubleConversion (1.1.7)
- Flipper-Folly (2.3.0):
- boost-for-react-native
- CocoaLibEvent (~> 1.0)
- Flipper-DoubleConversion
- Flipper-Glog
- OpenSSL-Universal (= 1.0.2.20)
- Flipper-Glog (0.3.6)
- Flipper-PeerTalk (0.0.4)
- Flipper-RSocket (1.1.1):
- Flipper-Folly (~> 2.3)
- FlipperKit (0.54.0):
- FlipperKit/Core (= 0.54.0)
- FlipperKit/Core (0.54.0):
- Flipper (~> 0.54.0)
- FlipperKit/CppBridge
- FlipperKit/FBCxxFollyDynamicConvert
- FlipperKit/FBDefines
- FlipperKit/FKPortForwarding
- FlipperKit/CppBridge (0.54.0):
- Flipper (~> 0.54.0)
- FlipperKit/FBCxxFollyDynamicConvert (0.54.0):
- Flipper-Folly (~> 2.2)
- FlipperKit/FBDefines (0.54.0)
- FlipperKit/FKPortForwarding (0.54.0):
- CocoaAsyncSocket (~> 7.6)
- Flipper-PeerTalk (~> 0.0.4)
- FlipperKit/FlipperKitHighlightOverlay (0.54.0)
- FlipperKit/FlipperKitLayoutPlugin (0.54.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutTextSearchable
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutTextSearchable (0.54.0)
- FlipperKit/FlipperKitNetworkPlugin (0.54.0):
- FlipperKit/Core
- FlipperKit/FlipperKitReactPlugin (0.54.0):
- FlipperKit/Core
- FlipperKit/FlipperKitUserDefaultsPlugin (0.54.0):
- FlipperKit/Core
- FlipperKit/SKIOSNetworkPlugin (0.54.0):
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- Folly (2020.01.13.00):
- boost-for-react-native
- DoubleConversion
- Folly/Default (= 2020.01.13.00)
- glog
- Folly/Default (2020.01.13.00):
- boost-for-react-native
- DoubleConversion
- glog
- glog (0.3.5)
- OpenSSL-Universal (1.0.2.20):
- OpenSSL-Universal/Static (= 1.0.2.20)
- OpenSSL-Universal/Static (1.0.2.20)
- RCTRequired (0.63.4)
- RCTTypeSafety (0.63.4):
- FBLazyVector (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTRequired (= 0.63.4)
- React-Core (= 0.63.4)
- React (0.63.4):
- React-Core (= 0.63.4)
- React-Core/DevSupport (= 0.63.4)
- React-Core/RCTWebSocket (= 0.63.4)
- React-RCTActionSheet (= 0.63.4)
- React-RCTAnimation (= 0.63.4)
- React-RCTBlob (= 0.63.4)
- React-RCTImage (= 0.63.4)
- React-RCTLinking (= 0.63.4)
- React-RCTNetwork (= 0.63.4)
- React-RCTSettings (= 0.63.4)
- React-RCTText (= 0.63.4)
- React-RCTVibration (= 0.63.4)
- React-callinvoker (0.63.4)
- React-Core (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/CoreModulesHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/Default (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/DevSupport (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.4)
- React-Core/RCTWebSocket (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- React-jsinspector (= 0.63.4)
- Yoga
- React-Core/RCTActionSheetHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTAnimationHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTBlobHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTImageHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTLinkingHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTNetworkHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTSettingsHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTTextHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTVibrationHeaders (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-Core/RCTWebSocket (0.63.4):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsiexecutor (= 0.63.4)
- Yoga
- React-CoreModules (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/CoreModulesHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- React-RCTImage (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-cxxreact (0.63.4):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-callinvoker (= 0.63.4)
- React-jsinspector (= 0.63.4)
- React-jsi (0.63.4):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-jsi/Default (= 0.63.4)
- React-jsi/Default (0.63.4):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-jsiexecutor (0.63.4):
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- React-jsinspector (0.63.4)
- react-native-video (4.4.2):
- React
- react-native-video/Video (= 4.4.2)
- react-native-video/Video (4.4.2):
- React
- React-RCTActionSheet (0.63.4):
- React-Core/RCTActionSheetHeaders (= 0.63.4)
- React-RCTAnimation (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTAnimationHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTBlob (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- React-Core/RCTBlobHeaders (= 0.63.4)
- React-Core/RCTWebSocket (= 0.63.4)
- React-jsi (= 0.63.4)
- React-RCTNetwork (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTImage (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTImageHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- React-RCTNetwork (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTLinking (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- React-Core/RCTLinkingHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTNetwork (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTNetworkHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTSettings (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.4)
- React-Core/RCTSettingsHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- React-RCTText (0.63.4):
- React-Core/RCTTextHeaders (= 0.63.4)
- React-RCTVibration (0.63.4):
- FBReactNativeSpec (= 0.63.4)
- Folly (= 2020.01.13.00)
- React-Core/RCTVibrationHeaders (= 0.63.4)
- React-jsi (= 0.63.4)
- ReactCommon/turbomodule/core (= 0.63.4)
- ReactCommon/turbomodule/core (0.63.4):
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-callinvoker (= 0.63.4)
- React-Core (= 0.63.4)
- React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4)
- RNCPicker (1.9.11):
- React-Core
- RNDateTimePicker (3.0.9):
- React-Core
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
DEPENDENCIES:
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
- Flipper (~> 0.54.0)
- Flipper-DoubleConversion (= 1.1.7)
- Flipper-Folly (= 2.3.0)
- Flipper-Glog (= 0.3.6)
- Flipper-PeerTalk (~> 0.0.4)
- Flipper-RSocket (~> 1.1)
- FlipperKit (~> 0.54.0)
- FlipperKit/Core (~> 0.54.0)
- FlipperKit/CppBridge (~> 0.54.0)
- FlipperKit/FBCxxFollyDynamicConvert (~> 0.54.0)
- FlipperKit/FBDefines (~> 0.54.0)
- FlipperKit/FKPortForwarding (~> 0.54.0)
- FlipperKit/FlipperKitHighlightOverlay (~> 0.54.0)
- FlipperKit/FlipperKitLayoutPlugin (~> 0.54.0)
- FlipperKit/FlipperKitLayoutTextSearchable (~> 0.54.0)
- FlipperKit/FlipperKitNetworkPlugin (~> 0.54.0)
- FlipperKit/FlipperKitReactPlugin (~> 0.54.0)
- FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.54.0)
- FlipperKit/SKIOSNetworkPlugin (~> 0.54.0)
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
- React (from `../node_modules/react-native/`)
- React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
- React-Core (from `../node_modules/react-native/`)
- React-Core/DevSupport (from `../node_modules/react-native/`)
- React-Core/RCTWebSocket (from `../node_modules/react-native/`)
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-video (from `../node_modules/react-native-video`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
- React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
- React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
- React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
- React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
- React-RCTText (from `../node_modules/react-native/Libraries/Text`)
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
- "RNDateTimePicker (from `../node_modules/@react-native-community/datetimepicker`)"
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
trunk:
- boost-for-react-native
- CocoaAsyncSocket
- CocoaLibEvent
- Flipper
- Flipper-DoubleConversion
- Flipper-Folly
- Flipper-Glog
- Flipper-PeerTalk
- Flipper-RSocket
- FlipperKit
- OpenSSL-Universal
- YogaKit
EXTERNAL SOURCES:
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
:path: "../node_modules/react-native/Libraries/FBLazyVector"
FBReactNativeSpec:
:path: "../node_modules/react-native/Libraries/FBReactNativeSpec"
Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
glog:
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
RCTRequired:
:path: "../node_modules/react-native/Libraries/RCTRequired"
RCTTypeSafety:
:path: "../node_modules/react-native/Libraries/TypeSafety"
React:
:path: "../node_modules/react-native/"
React-callinvoker:
:path: "../node_modules/react-native/ReactCommon/callinvoker"
React-Core:
:path: "../node_modules/react-native/"
React-CoreModules:
:path: "../node_modules/react-native/React/CoreModules"
React-cxxreact:
:path: "../node_modules/react-native/ReactCommon/cxxreact"
React-jsi:
:path: "../node_modules/react-native/ReactCommon/jsi"
React-jsiexecutor:
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
React-jsinspector:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-video:
:path: "../node_modules/react-native-video"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
:path: "../node_modules/react-native/Libraries/NativeAnimation"
React-RCTBlob:
:path: "../node_modules/react-native/Libraries/Blob"
React-RCTImage:
:path: "../node_modules/react-native/Libraries/Image"
React-RCTLinking:
:path: "../node_modules/react-native/Libraries/LinkingIOS"
React-RCTNetwork:
:path: "../node_modules/react-native/Libraries/Network"
React-RCTSettings:
:path: "../node_modules/react-native/Libraries/Settings"
React-RCTText:
:path: "../node_modules/react-native/Libraries/Text"
React-RCTVibration:
:path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNCPicker:
:path: "../node_modules/@react-native-picker/picker"
RNDateTimePicker:
:path: "../node_modules/@react-native-community/datetimepicker"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
DoubleConversion: cde416483dac037923206447da6e1454df403714
FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
Flipper: be611d4b742d8c87fbae2ca5f44603a02539e365
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Folly: e4493b013c02d9347d5e0cb4d128680239f6c78a
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: a3acb8812d6adf127deb0a5edae2793b97e6b641
FlipperKit: ab353d41aea8aae2ea6daaf813e67496642f3d7d
Folly: b73c3869541e86821df3c387eb0af5f65addfab4
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
OpenSSL-Universal: ff34003318d5e1163e9529b08470708e389ffcdd
RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e
RCTTypeSafety: 8c9c544ecbf20337d069e4ae7fd9a377aadf504b
React: b0a957a2c44da4113b0c4c9853d8387f8e64e615
React-callinvoker: c3f44dd3cb195b6aa46621fff95ded79d59043fe
React-Core: d3b2a1ac9a2c13c3bcde712d9281fc1c8a5b315b
React-CoreModules: 0581ff36cb797da0943d424f69e7098e43e9be60
React-cxxreact: c1480d4fda5720086c90df537ee7d285d4c57ac3
React-jsi: a0418934cf48f25b485631deb27c64dc40fb4c31
React-jsiexecutor: 93bd528844ad21dc07aab1c67cb10abae6df6949
React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a
react-native-video: aed899073f5572418696ba6af3f31e4d371fd2f1
React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336
React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b
React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0
React-RCTImage: c1b1f2d3f43a4a528c8946d6092384b5c880d2f0
React-RCTLinking: 35ae4ab9dc0410d1fcbdce4d7623194a27214fb2
React-RCTNetwork: 29ec2696f8d8cfff7331fac83d3e893c95ef43ae
React-RCTSettings: 60f0691bba2074ef394f95d4c2265ec284e0a46a
React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
RNCPicker: 6780c753e9e674065db90d9c965920516402579d
RNDateTimePicker: 8a51a2216c307769e69ef827293d59549ab1ca23
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
PODFILE CHECKSUM: abd2287d7479a1eebd3e31abe21be1085af79631
COCOAPODS: 1.10.0

Просмотреть файл

@ -1,4 +0,0 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

Просмотреть файл

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

Просмотреть файл

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Просмотреть файл

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "RNAdaptiveCards-tvOS.app"
BlueprintName = "RNAdaptiveCards-tvOS"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "RNAdaptiveCards-tvOSTests.xctest"
BlueprintName = "RNAdaptiveCards-tvOSTests"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "RNAdaptiveCards-tvOS.app"
BlueprintName = "RNAdaptiveCards-tvOS"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "RNAdaptiveCards-tvOS.app"
BlueprintName = "RNAdaptiveCards-tvOS"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "RNAdaptiveCards.app"
BlueprintName = "RNAdaptiveCards"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "RNAdaptiveCardsTests.xctest"
BlueprintName = "RNAdaptiveCardsTests"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "RNAdaptiveCards.app"
BlueprintName = "RNAdaptiveCards"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "RNAdaptiveCards.app"
BlueprintName = "RNAdaptiveCards"
ReferencedContainer = "container:RNAdaptiveCards.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:RNAdaptiveCards.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Просмотреть файл

@ -1,8 +0,0 @@
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
@property (nonatomic, strong) UIWindow *window;
@end

Просмотреть файл

@ -1,55 +0,0 @@
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#endif
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self initializeFlipper:application];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"RNAdaptiveCards" initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
- (void) initializeFlipper:(UIApplication *)application {
#ifdef FB_SONARKIT_ENABLED
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin: [[FlipperKitLayoutPlugin alloc] initWithRootNode: application withDescriptorMapper: layoutDescriptorMapper]];
[client addPlugin: [[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin: [FlipperKitReactPlugin new]];
[client addPlugin: [[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
#endif
}
@end

Просмотреть файл

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RNAdaptiveCards" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>

Просмотреть файл

@ -1,53 +0,0 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Просмотреть файл

@ -1,6 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Просмотреть файл

@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "adaptive10.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 61 KiB

Просмотреть файл

@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "background.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Просмотреть файл

@ -1,21 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "button.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.4 KiB

Просмотреть файл

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>RNAdaptiveCards</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

Просмотреть файл

@ -1,9 +0,0 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

Просмотреть файл

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

Просмотреть файл

@ -1,65 +0,0 @@
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import <React/RCTLog.h>
#import <React/RCTRootView.h>
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React"
@interface RNAdaptiveCardsTests : XCTestCase
@end
@implementation RNAdaptiveCardsTests
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
{
if (test(view)) {
return YES;
}
for (UIView *subview in [view subviews]) {
if ([self findSubviewInView:subview matching:test]) {
return YES;
}
}
return NO;
}
- (void)testRendersWelcomeScreen
{
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
BOOL foundElement = NO;
__block NSString *redboxError = nil;
#ifdef DEBUG
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
#endif
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
}
#ifdef DEBUG
RCTSetLogFunction(RCTDefaultLogFunction);
#endif
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
}
@end

Просмотреть файл

@ -1,9 +0,0 @@
//
// rnadaptivecards-test.swift
// RNAdaptiveCards
//
// Created by Ibrahim on 07/04/20.
// Copyright © 2020 Facebook. All rights reserved.
//
import Foundation

28323
source/community/reactnative/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,65 +0,0 @@
{
"name": "adaptivecards-reactnative",
"description": "AdaptiveCards implementation in ReactNative",
"version": "2.2.7",
"keywords": [
"adaptivecards",
"cards",
"bot",
"microsoft cards",
"reactnative cards"
],
"author": {
"name": "BigThinkCode",
"url": "https://github.com/BigThinkcode"
},
"private": false,
"license": "MIT",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"repository": {
"url": "https://github.com/Bigthinkcode/AdaptiveCards/tree/main/source/community/reactnative",
"type": "git"
},
"files": [
"src/components",
"src/styles",
"src/utils",
"src/models",
"src/adaptive-card.js"
],
"main": "./src/adaptive-card",
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^25.1.0",
"eslint": "^6.5.1",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"react": "16.13.1",
"react-native": "0.63.4",
"react-test-renderer": "16.13.1",
"rnpm-plugin-windows": "^0.2.11"
},
"dependencies": {
"@react-native-community/datetimepicker": "^3.0.9",
"@react-native-picker/picker": "^1.9.11",
"adaptivecards-templating": "1.0.0-rc.0",
"antlr4ts": "^0.5.0-alpha.3",
"assert": "^2.0.0",
"react-native-video": "^4.4.2",
"react-native-windows": "0.57.1"
},
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|@react-native-community|@react-native-picker)"
]
}
}

Просмотреть файл

@ -1,343 +0,0 @@
/**
* Render the adaptive card for the given payload.
*/
import React from 'react';
import {
StyleSheet,
Text,
ScrollView,
KeyboardAvoidingView,
Platform
} from 'react-native';
import { Registry } from './components/registration/registry';
import { InputContextProvider } from './utils/context';
import { HostConfig, defaultHostConfig } from './utils/host-config';
import { StyleConfig } from './styles/style-config';
import { ThemeConfig, defaultThemeConfig } from './utils/theme-config';
import { ActionWrapper } from './components/actions/action-wrapper';
import PropTypes from 'prop-types';
import * as Utils from './utils/util';
import { SelectAction } from './components/actions';
import ResourceInformation from './utils/resource-information';
import { ContainerWrapper } from './components/containers';
import { ModelFactory } from './models';
import { PlatformIOS, BehaviourHeight, BehaviourPadding } from "./utils/constants"
export default class AdaptiveCard extends React.Component {
// Input elements with its identifier and value
inputArray = {};
version = "2.0"; // client supported version
resourceInformationArray = [];
constructor(props) {
super(props);
this.payload = props.payload;
if (props.isActionShowCard && props.configManager) {
/**
* If it's ActionShowCard then all the config will be already available in props
*/
this.configManager = props.configManager;
this.hostConfig = props.configManager.hostConfig;
this.themeConfig = props.configManager.themeConfig;
this.styleConfig = props.configManager.styleConfig;
} else {
// hostConfig
this.hostConfig = new HostConfig(props.hostConfig || defaultHostConfig);
// themeConfig
let themeConfigValues = { ...defaultThemeConfig, ...(props.themeConfig || {}) }
this.themeConfig = new ThemeConfig(themeConfigValues);
//styleConfig
this.styleConfig = new StyleConfig(this.hostConfig, this.themeConfig).getStyleConfig();
this.configManager = {
hostConfig: this.hostConfig,
themeConfig: this.themeConfig,
styleConfig: this.styleConfig
}
}
if (props.isActionShowCard)
this.cardModel = props.payload;
else
this.cardModel = ModelFactory.createElement(props.payload, undefined, this.hostConfig);
this.state = {
showErrors: false,
payload: this.payload,
cardModel: this.cardModel
}
}
toggleVisibilityForElementWithID = (idArray) => {
this.toggleCardModelObject(this.cardModel, [...idArray]);
this.setState({
cardModel: this.cardModel,
})
}
/**
* @description Checks the elements recursively to change the isVisible property
* @param {Object} object - the object to be searched
* @param {Array} targetElements - the array of target Ids to be toggled
*/
checkTargetElementsForID = (object, targetElements) => {
targetElements.forEach(target => {
if (target instanceof String || typeof target === 'string') {
if (target == object["id"]) {
object.isVisible = !object.isVisible;
var index = targetElements.indexOf(object["id"]);
if (index !== -1) targetElements.splice(index, 1);
return
}
} else if ((target instanceof Object || typeof target === 'object') && target !== null) {
if (target["elementId"] === object["id"]) {
if (!Utils.isNullOrEmpty(target["isVisible"])) {
object.isVisible = target["isVisible"]
} else {
object.isVisible = !object.isVisible;
}
var index = targetElements.indexOf(target);
if (index !== -1) targetElements.splice(index, 1);
return
}
}
});
}
/**
* @description Method to toggle the visibility of the component by looking in its children
* @param {Object} object - the object to be searched for ids
* @param {string} idValue - the id of the component to be toggled
*/
toggleCardModelObject = (object, idArrayValue) => {
if (idArrayValue.length === 0) return
if (object.hasOwnProperty('id')) {
this.checkTargetElementsForID(object, idArrayValue);
if (idArrayValue.length === 0) return
}
if ((object.children !== undefined) && object.children.length !== 0) {
object.children.forEach(element => {
if (idArrayValue.length === 0) return
this.toggleCardModelObject(element, idArrayValue);
});
}
//Adaptive cards has actions array in addition to the body which is added as children
if (object.type === 'AdaptiveCard') {
if ((object.actions !== undefined) && object.actions.length !== 0) {
object.actions.forEach(element => {
if (idArrayValue.length === 0) return
this.toggleCardModelObject(element, idArrayValue);
});
}
}
return;
}
/**
* @description Returns the resource information in the card elements as an array
* @returns {Array} - Array of items of type ResourceInformation
*/
getResourceInformation = () => {
return this.resourceInformationArray;
}
/**
* @description Input elements present in the cards are added here with its value.
*/
addInputItem = (key, value) => {
this.inputArray[key] = value;
}
/**
* @description Resource information present in the card elements are added here with the url and mimetype.
* @param {string} urlString - URL of the resource (Ex: URL of the Image element)
* @param {string} mimeTypeString - MIME type of the resource if the same is available in the element's payload
*/
addResourceInformation = (urlString, mimeTypeString) => {
let newResourceObject = new ResourceInformation(urlString, mimeTypeString);
this.resourceInformationArray.push(newResourceObject);
}
/**
* @description Parse the given payload and render the card accordingly
* @returns {object} Child elements of the card
*/
parsePayload = () => {
let children = [];
if (this.state.cardModel.children.length === 0)
return children;
children = Registry.getManager().parseRegistryComponents(this.state.cardModel.children, this.onParseError);
return children.map((ChildElement, index) => React.cloneElement(ChildElement, {
containerStyle: this.state.cardModel.style,
isFirst: index === 0,
configManager: this.configManager
}));
}
getAdaptiveCardContent() {
let containerStyles = [styles.container]
//If containerStyle is passed by the user from adaptive card via props, we will override this style
this.props.containerStyle && containerStyles.push(this.props.containerStyle)
//if this.state.cardModel.minHeight is undefined or null, then minheight value will be null. So it will automatically handled the undefined and null cases also...
const minHeight = Utils.convertStringToNumber(this.state.cardModel.minHeight);
//We will pass the style as array, since it can be updated in the container wrapper if required.
typeof minHeight === "number" && containerStyles.push({ minHeight });
//If contentHeight is passed by the user from adaptive card via props, we will set this as height
this.props.contentHeight && containerStyles.push({ height: this.props.contentHeight })
var adaptiveCardContent =
(
<ContainerWrapper configManager={this.configManager} style={containerStyles} json={this.state.cardModel}>
<ScrollView
contentContainerStyle={this.props.contentContainerStyle}
showsHorizontalScrollIndicator={true}
showsVerticalScrollIndicator={true}
alwaysBounceVertical={false}
alwaysBounceHorizontal={false}
scrollEnabled={this.props.cardScrollEnabled}>
{this.parsePayload()}
{!Utils.isNullOrEmpty(this.state.cardModel.actions) &&
<ActionWrapper configManager={this.configManager} actions={this.state.cardModel.actions} />}
</ScrollView>
</ContainerWrapper>
);
if (!this.props.isActionShowCard) {
adaptiveCardContent = (
<KeyboardAvoidingView keyboardVerticalOffset={40}
behavior={Platform.OS == PlatformIOS ? BehaviourPadding : BehaviourHeight}>
{adaptiveCardContent}
</KeyboardAvoidingView>
);
}
// checks if selectAction option is available for adaptive card
if (!Utils.isNullOrEmpty(this.payload.selectAction)) {
adaptiveCardContent = (
<SelectAction configManager={this.configManager} selectActionData={this.payload.selectAction}>
{adaptiveCardContent}
</SelectAction>
);
}
return adaptiveCardContent;
}
render() {
const { addInputItem, inputArray, addResourceInformation, toggleVisibilityForElementWithID } = this;
const onExecuteAction = this.onExecuteAction;
const isTransparent = this.payload.backgroundImage ? true : false;
const onParseError = this.onParseError;
const lang = this.payload.lang || 'en';
const { showErrors } = this.state;
// version check
if (!this.isSupportedVersion()) {
const message = this.payload.fallbackText || "We're sorry, this card couldn't be displayed";
return (
<Text style={this.styleConfig.defaultFontConfig}>{message}</Text>
)
}
return (
<InputContextProvider value={{ lang, addInputItem, inputArray, onExecuteAction, isTransparent, onParseError, addResourceInformation, showErrors, toggleVisibilityForElementWithID }}>
{
this.getAdaptiveCardContent()
}
</InputContextProvider>
);
}
/**
* Check whether the payload schema version is supported by client.
* @return {boolean} - version supported or not
*/
isSupportedVersion = () => {
//Ignore the schema version number when AdaptiveCard is used from Action.ShowCard as it is not mandatory
if (this.props.isActionShowCard) {
return true;
}
if (!this.payload.version)
return false;
const payloadVersion = Utils.parseVersion(this.payload.version);
const clientVersion = Utils.parseVersion(this.version);
if (clientVersion.major != payloadVersion.major) {
return payloadVersion.major < clientVersion.major;
}
else if (clientVersion.minor != payloadVersion.minor) {
return payloadVersion.minor < clientVersion.minor;
}
else {
return true;
}
}
// Invoke onParseError if the consumer app provide it via props.
onParseError = (error) => {
if (this.props.onParseError) {
this.props.onParseError(error);
}
}
// Invoke onExecuteAction if the consumer app provide it via props.
onExecuteAction = (action, ignoreInputValidation) => {
if (!ignoreInputValidation && !this.validateInputs())
this.setState({ showErrors: true });
else if (this.props.onExecuteAction) {
this.props.onExecuteAction(action);
}
}
validateInputs = () => {
const { inputArray } = this;
if (inputArray) {
for (const key in inputArray) {
if (inputArray[key].errorState)
return false;
}
}
return true;
}
}
// AdaptiveCard.propTypes
AdaptiveCard.propTypes = {
payload: PropTypes.object.isRequired,
hostConfig: PropTypes.object,
themeConfig: PropTypes.object,
onExecuteAction: PropTypes.func,
onParseError: PropTypes.func,
contentHeight: PropTypes.number,
containerStyle: PropTypes.object,
contentContainerStyle: PropTypes.object,
cardScrollEnabled: PropTypes.bool
};
AdaptiveCard.defaultProps = {
cardScrollEnabled: true
};
const styles = StyleSheet.create({
container: {
padding: 10
},
actionContainer: {
marginVertical: 10
},
backgroundImage: {
width: "100%"
}
});

Просмотреть файл

@ -1,265 +0,0 @@
/**
* Actions Component.
*
* Refer https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema#schema-action.openurl
*/
import React from 'react';
import {
Text,
View,
StyleSheet,
Image,
Platform,
TouchableOpacity,
TouchableNativeFeedback
} from 'react-native';
import * as Utils from '../../utils/util';
import {
InputContext,
InputContextConsumer
} from '../../utils/context';
import * as Constants from '../../utils/constants';
import * as Enums from '../../utils/enums';
export class ActionButton extends React.Component {
static contextType = InputContext;
constructor(props) {
super(props);
this.payload = props.json;
this.title = Constants.EmptyString;
this.verb = Constants.EmptyString;
this.altText = Constants.EmptyString;
this.type = Constants.EmptyString;
this.iconUrl = Constants.EmptyString;
this.inputArray = undefined;
this.onExecuteAction = undefined;
this.addResourceInformation = undefined;
this.toggleVisibilityForElementWithID = undefined;
this.data = {};
if (props.json.type === 'Action.ShowCard') {
this.showCardHandler = props.onShowCardTapped;
}
this.hostConfig = props.configManager.hostConfig;
this.styleConfig = props.configManager.styleConfig;
}
componentDidMount() {
if (!Utils.isNullOrEmpty(this.payload.iconUrl)) {
this.addResourceInformation(this.payload.iconUrl, "");
}
}
getActionAlignment() {
let computedStyles = [];
if (this.hostConfig.actions.actionAlignment != Enums.ActionAlignment.Stretch) {
computedStyles.push({ flexGrow: 0 })
} else computedStyles.push({ flexGrow: 1 })
if (this.hostConfig.actions.actionsOrientation === Enums.Orientation.Horizontal) {
computedStyles.push({ maxWidth: this.props.maxWidth })
}
return computedStyles;
}
render() {
if (!this.hostConfig.supportsInteractivity) {
return null;
}
this.parsePayload();
let computedStyle = [this.getActionAlignment()];
computedStyle.push({ opacity: this.payload.isEnabled ? 1.0 : 0.4 })
const ButtonComponent = Platform.OS === Constants.PlatformAndroid ? TouchableNativeFeedback : TouchableOpacity;
return (<InputContextConsumer>
{({ onExecuteAction, inputArray, addResourceInformation, toggleVisibilityForElementWithID }) => {
this.inputArray = inputArray;
this.onExecuteAction = onExecuteAction;
this.addResourceInformation = addResourceInformation;
this.toggleVisibilityForElementWithID = toggleVisibilityForElementWithID;
return <ButtonComponent
style={computedStyle}
disabled={!this.payload.isEnabled}
accessible={true}
accessibilityLabel={this.altText}
accessibilityRole={Constants.Button}
onPress={this.onActionButtonTapped}>
{this.buttonContent()}
</ButtonComponent>
}}
</InputContextConsumer>);
}
/**
* @description Invoked for the any action button selected
*/
onActionButtonTapped = () => {
switch (this.payload.type) {
case Constants.ActionSubmit:
this.onSubmitExecuteActionCalled();
break;
case Constants.ActionExecute:
this.onSubmitExecuteActionCalled();
break;
case Constants.ActionOpenUrl:
this.onOpenURLCalled();
break;
case Constants.ActionShowCard:
this.changeShowCardState();
break;
case Constants.ActionToggleVisibility:
this.onToggleActionCalled();
break;
default:
//Invoked for the custom action type.
this.onExecuteAction(this.payload);
break;
}
}
getMergeObject = () => {
let mergedObject = {};
for (const key in this.inputArray) {
mergedObject[key] = this.inputArray[key].value;
}
if (this.data !== null) {
if (this.data instanceof Object)
mergedObject = { ...mergedObject, ...this.data }
else
mergedObject["actionData"] = this.data;
}
return mergedObject
}
/**
* @description Invoked for the action type Constants.ActionSubmit and Constants.ActionExecute
*/
onSubmitExecuteActionCalled() {
const { type, verb = "", title = "", ignoreInputValidation } = this.payload;
var actionObject = { "type": type, "title": title, "data": this.getMergeObject() };
if (this.payload.type == Constants.ActionExecute) {
actionObject["verb"] = verb
}
this.onExecuteAction(actionObject, ignoreInputValidation);
}
/**
* @description Invoked for the action type Constants.ActionToggleVisibility
*/
onToggleActionCalled() {
this.toggleVisibilityForElementWithID(this.payload.targetElements);
}
onOpenURLCalled = () => {
let actionObject = { "type": this.payload.type, "url": this.payload.url };
this.onExecuteAction(actionObject);
}
changeShowCardState = () => {
this.showCardHandler(this.payload.children[0]);
}
parsePayload() {
this.title = this.payload.title;
this.altText = this.payload.altText || this.title;
this.type = this.payload.type;
let imageUrl = this.payload.iconUrl
this.iconUrl = Utils.getImageUrl(imageUrl)
this.data = this.payload.data;
this.sentiment = this.payload.sentiment;
this.sentiment = Utils.parseHostConfigEnum(
Enums.Sentiment,
this.payload.sentiment,
Enums.Sentiment.Default
);
}
/**
* @description Return the button styles applicable
* @returns {Array} computedStyles - Styles based on the config
*/
getButtonStyles = () => {
let computedStyles = [this.styleConfig.button,
this.styleConfig.actionIconFlex, styles.button];
if (this.sentiment == Enums.Sentiment.Positive) {
computedStyles.push(this.styleConfig.defaultPositiveButtonBackgroundColor);
} else if (this.sentiment == Enums.Sentiment.Destructive) {
computedStyles.push(this.styleConfig.defaultDestructiveButtonBackgroundColor);
}
if (this.hostConfig.actions.actionAlignment != Enums.ActionAlignment.Stretch && this.hostConfig.actions.actionsOrientation === Enums.Orientation.Vertical) {
switch (this.hostConfig.actions.actionAlignment) {
case Enums.ActionAlignment.Center:
computedStyles.push(styles.centerAlignment)
break
case Enums.ActionAlignment.Right:
computedStyles.push(styles.rightAlignment)
break
default:
computedStyles.push(styles.leftAlignment)
}
}
computedStyles.push(this.props.style)
return computedStyles;
}
/**
* @description Return the button title styles applicable
* @returns {Array} computedStyles - Styles based on the config
*/
getButtonTitleStyles = () => {
var computedStyles = [this.styleConfig.defaultFontConfig,
this.styleConfig.buttonTitle, this.props.titleStyle];
return computedStyles;
}
buttonContent = () => {
return (
<View
style={this.getButtonStyles()}>
{
!Utils.isNullOrEmpty(this.iconUrl) ?
<Image resizeMode="center"
source={{ uri: this.iconUrl }}
style={[styles.buttonIcon, this.styleConfig.actionIcon]} />
: null
}
<Text numberOfLines={1} style={this.getButtonTitleStyles()}>
{this.title}
</Text>
</View>
);
};
}
const styles = StyleSheet.create({
button: {
alignItems: Constants.CenterString,
justifyContent: Constants.CenterString,
padding: 10,
marginBottom: 10,
flexGrow: 1,
marginHorizontal: 5
},
buttonIcon: {
marginLeft: 5,
marginRight: 10,
},
leftAlignment: {
alignSelf: Constants.FlexStart,
},
centerAlignment: {
alignSelf: Constants.CenterString,
},
rightAlignment: {
alignSelf: Constants.FlexEnd,
}
});

Просмотреть файл

@ -1,27 +0,0 @@
/**
* ActionSet Element.
*
* Refer https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema#schema-textblock
*/
import React from 'react';
import {
StyleSheet
} from 'react-native';
import ElementWrapper from '../elements/element-wrapper';
import { ActionWrapper } from './action-wrapper';
export class ActionSet extends React.Component {
render() {
let payload = this.props.json;
return (
<ElementWrapper configManager={this.props.configManager} json={payload} isFirst={this.props.isFirst}>
<ActionWrapper configManager={this.props.configManager} actions={payload.actions} />
</ElementWrapper>
);
}
}

Просмотреть файл

@ -1,152 +0,0 @@
/**
* Wrapper to render the actions from given payload.
*/
import React from 'react';
import {
StyleSheet,
View
} from 'react-native';
import { Registry } from '../registration/registry';
import * as Constants from '../../utils/constants';
import { InputContextConsumer } from '../../utils/context';
import AdaptiveCard from '../../adaptive-card';
import * as Utils from '../../utils/util';
import * as Enums from '../../utils/enums';
const padding = 10;
export class ActionWrapper extends React.Component {
constructor(props) {
super(props);
this.hostConfig = props.configManager.hostConfig;
this.state = {
isShowCard: false,
cardJson: null,
}
}
hasShowCard = false;
onShowAdaptiveCard = (adaptiveCard) => {
let isDifferentcard = (Utils.isNullOrEmpty(this.state.cardJson) ? false :
(adaptiveCard === this.state.cardJson ? false : true));
this.setState(prevState => ({
isShowCard: !prevState.isShowCard,
cardJson: adaptiveCard
}));
if (isDifferentcard) {
setTimeout(() => {
this.setState({ isShowCard: true });
}, 50)
}
}
/**
* @description Parses the actions from the given json
*/
parseActionsArray = (onParseError) => {
const renderedElement = [];
const { actions } = this.props
if (!actions)
return renderedElement;
actions.map((element, index) => {
const Element = Registry.getManager().getComponentOfType(element.type);
if (Element) {
let isValid = true;
for (var key in Registry.getManager().validateSchemaForType(element.type)) {
if (!element.hasOwnProperty(key)) {
let error = { "error": Enums.ValidationError.PropertyCantBeNull, "message": `Required property ${key} for ${element.type} is missing` };
onParseError(error);
isValid = false;
}
}
if (isValid) {
const isFirstElement = index == 0 || this.hostConfig.actions.actionsOrientation === Enums.Orientation.Vertical
if (element.type === 'Action.ShowCard') {
this.hasShowCard = true;
renderedElement.push(
<Element
json={element}
isFirst={isFirstElement}
maxWidth={100 / actions.length + "%"}
configManager={this.props.configManager}
onShowCardTapped={this.onShowAdaptiveCard}
key={`${element.type}-${index}`}
/>);
}
else {
renderedElement.push(<Element json={element} configManager={this.props.configManager} isFirst={isFirstElement} maxWidth={100 / actions.length + "%"} key={`${element.type}-${index}`} />);
}
}
} else {
let error = { "error": Enums.ValidationError.UnknownActionType, "message": `Unknown Type ${element.type} encountered` };
onParseError(error);
return null;
}
});
return renderedElement;
}
getActionOrientation() {
if (this.hostConfig.actions.actionsOrientation === Enums.Orientation.Horizontal)
return styles.actionAlignmentHorizontal
else return styles.actionAlignmentVertical
}
getActionAlignment() {
switch (this.hostConfig.actions.actionAlignment) {
case Enums.ActionAlignment.Center:
return styles.centerAlignment
case Enums.ActionAlignment.Right:
return styles.rightAlignment
default:
return styles.leftAlignment
}
}
render() {
return (<InputContextConsumer>
{({ onExecuteAction, onParseError }) =>
<View>
<View style={[styles.actionButtonContainer, this.getActionOrientation(), this.getActionAlignment()]}>
{this.parseActionsArray(onParseError)}
</View>
{this.hasShowCard ? ((this.state.isShowCard) ?
<AdaptiveCard
payload={this.state.cardJson}
configManager={this.props.configManager}
onExecuteAction={onExecuteAction} isActionShowCard={true} /> : null) : null}
</View>
}
</InputContextConsumer>);
}
}
const styles = StyleSheet.create({
actionButtonContainer: {
paddingTop: padding,
flexWrap: Constants.FlexWrap
},
actionAlignmentHorizontal: {
flexDirection: Constants.FlexRow,
},
actionAlignmentVertical: {
flexDirection: Constants.FlexColumn,
},
leftAlignment: {
justifyContent: Constants.FlexStart,
},
centerAlignment: {
justifyContent: Constants.CenterString,
},
rightAlignment: {
justifyContent: Constants.FlexEnd,
}
});

Просмотреть файл

@ -1,3 +0,0 @@
export * from './action-button';
export * from './select-Action';
export * from './action-set';

Просмотреть файл

@ -1,82 +0,0 @@
/**
* SelectAction Component.
*/
import React from 'react';
import {
TouchableOpacity,
} from 'react-native';
import {
InputContext,
InputContextConsumer
} from '../../utils/context';
import * as Constants from '../../utils/constants';
import * as Utils from '../../utils/util';
export class SelectAction extends React.Component {
static contextType = InputContext;
constructor(props) {
super(props);
this.payload = this.props.selectActionData;
this.onExecuteAction = undefined;
this.toggleVisibilityForElementWithID = undefined;
}
/**
* @description Invoked on tapping the button component
*/
onClickHandle() {
const { type, verb = "", title = "", data } = this.payload;
switch (type) {
case Constants.ActionSubmit:
this.onExecuteAction({ type, title, data });
break;
case Constants.ActionExecute:
this.onExecuteAction({ type, verb, title, data });
break;
case Constants.ActionOpenUrl:
if (!Utils.isNullOrEmpty(this.props.selectActionData.url)) {
let actionObject = { "type": Constants.ActionOpenUrl, "url": this.props.selectActionData.url };
this.onExecuteAction(actionObject);
}
break;
case Constants.ActionToggleVisibility:
this.toggleVisibilityForElementWithID(this.props.selectActionData.targetElements);
break;
default:
//As per the AC schema, ShowCard action type is not supported by selectAction.
if (this.payload.type != Constants.ActionShowCard) {
//Invoked for the custom action type.
this.onExecuteAction(this.payload);
}
break;
}
}
render() {
if (!this.props.configManager.hostConfig.supportsInteractivity) {
return null;
}
const ButtonComponent = TouchableOpacity;
return (<InputContextConsumer>
{({ onExecuteAction, toggleVisibilityForElementWithID }) => {
this.onExecuteAction = onExecuteAction;
this.toggleVisibilityForElementWithID = toggleVisibilityForElementWithID;
return <ButtonComponent
onPress={() => { this.onClickHandle() }}
disabled={this.payload.isEnabled == undefined ? false : !this.payload.isEnabled} //isEnabled defaults to true
accessible={true}
accessibilityLabel={this.payload.altText}
accessibilityRole={Constants.Button}
style={this.props.style}>
<React.Fragment>{this.props.children}</React.Fragment>
</ButtonComponent>
}}
</InputContextConsumer>);
}
}

Просмотреть файл

@ -1,187 +0,0 @@
/**
* Column Component.
*
* Refer https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema#schema-column
*/
import React from 'react';
import {
View,
StyleSheet,
Dimensions
} from 'react-native';
import { InputContext } from '../../utils/context';
import { Registry } from '../registration/registry';
import * as Utils from '../../utils/util';
import * as Constants from '../../utils/constants';
import * as Enums from '../../utils/enums';
import { SelectAction } from '../actions';
import { ContainerWrapper } from './';
const deviceWidth = Dimensions.get('window').width;
export class Column extends React.Component {
static contextType = InputContext;
spacing = 0;
constructor(props) {
super(props);
this.hostConfig = props.configManager.hostConfig;
this.column = props.json;
}
/**
* @description Parse the given payload and render the card accordingly
* @returns {object} Return the child elements of the column
*/
parsePayload = () => {
let children = [];
if (!this.column)
return children;
if (this.column.isFallbackActivated) {
if (this.column.fallbackType == "drop") {
return null;
} else if (!Utils.isNullOrEmpty(element.fallback)) {
return Registry.getManager().parseComponent(this.column.fallback, this.context.onParseError);
}
}
// parse elements
if (!Utils.isNullOrEmpty(this.column.items) && (this.column.isVisible !== false)) {
children = Registry.getManager().parseRegistryComponents(this.column.items, this.context.onParseError);
}
return children.map((ChildElement, index) => React.cloneElement(ChildElement, {
containerStyle: this.column.style,
isFirst: index === 0, columnWidth: this.column.width,
configManager: this.props.configManager
}));
}
/**
* @description This function determines whether the current column element(this.column)
* is the first element of the columns(this.props.columns) array.
* @returns {boolean} true|false
*/
isForemostElement = () => {
return this.props.columns[0] === this.column;
}
/**
* @description This function renders a separator between the columns
* based on the separator property from the payload.
* @returns {Component|null}
*/
renderSeparator = () => {
const { lineColor, lineThickness } = this.hostConfig.separator
const margin = (this.spacing - lineThickness) / 2
if (!this.isForemostElement()) {
return (
<View style={{
borderLeftWidth: lineThickness,
borderLeftColor: lineColor,
marginLeft: margin,
marginRight: margin
}} />
);
} else {
return null;
}
}
/**
* @description This function calculates flex value
* based on the column width property from the payload.
* @returns {flex}
*/
flex = (containerViewStyle) => {
var flex = 0
var columns = this.props.columns
const widthArray = columns.map((column) => column.width);
var sizeValues = []
widthArray.map((value) => {
if (Utils.isaNumber(value)) {
sizeValues.push(value)
}
})
var minValue = Math.min.apply(null, sizeValues)
var maxValue = Math.max.apply(null, sizeValues)
if (Utils.isaNumber(this.column.width)) {
flex = this.column.width / maxValue
}
else if (!this.column || this.column.width === 'auto') {
if (sizeValues.length == 0) {
containerViewStyle.push({ flexWrap: 'wrap' })
} else {
flex = minValue / maxValue
}
}
else if (this.column.width === undefined || this.column.width === 'stretch') {
flex = 1
}
return flex;
}
render() {
const { isFirst, isLast } = this.props;
const separator = this.column.separator || false;
let containerViewStyle = [{
flexDirection: separator ?
Constants.FlexRow : Constants.FlexColumn
}];
const spacingEnumValue = Utils.parseHostConfigEnum(
Enums.Spacing,
this.column.spacing,
Enums.Spacing.Default);
this.spacing = this.hostConfig.getEffectiveSpacing(spacingEnumValue);
let spacingStyle = [];
if (!this.isForemostElement() && this.column.spacing) {
spacingStyle.push({ marginLeft: this.spacing })
}
spacingStyle.push({ flexGrow: 1 });
if (Utils.isPixelValue(this.column.width) && Utils.isaNumber(this.column.width)) {
containerViewStyle.push({ width: parseInt(this.column.width) })
} else {
containerViewStyle.push({ flex: this.flex(containerViewStyle) })
}
let ActionComponent = React.Fragment;
let actionComponentProps = {};
// select action
if ((!Utils.isNullOrEmpty(this.column.selectAction)) && this.hostConfig.supportsInteractivity) {
ActionComponent = SelectAction;
actionComponentProps = { selectActionData: this.column.selectAction, configManager: this.props.configManager };
}
let separatorStyles = [spacingStyle];
if (separator) {
separatorStyles = [containerViewStyle, styles.separatorStyle];
}
return <ContainerWrapper configManager={this.props.configManager} json={this.column} hasBackgroundImage={this.props.hasBackgroundImage} isFirst={isFirst} isLast={isLast} style={[containerViewStyle]} containerStyle={this.props.containerStyle}>
<ActionComponent {...actionComponentProps}>
{separator && this.renderSeparator()}
<View style={separatorStyles}>
{this.parsePayload()}
</View>
</ActionComponent>
</ContainerWrapper>
}
};
const styles = StyleSheet.create({
separatorStyle: {
flexDirection: Constants.FlexColumn,
flexGrow: 1,
},
defaultBGStyle: {
backgroundColor: Constants.TransparentString,
},
});

Просмотреть файл

@ -1,82 +0,0 @@
/**
* ColumnSet Component.
*
* Refer https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema#schema-columnset
*/
import React from 'react';
import {
StyleSheet
} from 'react-native';
import { SelectAction } from '../actions';
import ElementWrapper from '../elements/element-wrapper';
import { Column } from "./column";
import * as Constants from '../../utils/constants';
import { ContainerWrapper } from './';
export class ColumnSet extends React.PureComponent {
constructor(props) {
super(props);
this.hostConfig = props.configManager.hostConfig;
this.payload = props.json;
}
/**
* @description Parse the given payload and render the card accordingly
* @returns {object} Return the child elements of the columnset
*/
parsePayload = () => {
const payload = this.payload;
const children = [];
if (!this.payload)
return children;
// parse elements
payload.columns.map((element, index) => {
children.push(
<Column json={element}
columns={payload.columns}
configManager={this.props.configManager}
hasBackgroundImage={payload.parent.backgroundImage}
key={`ELEMENT-${index}`}
isFirst={index === 0}
isLast={index === payload.columns.length - 1}
/>);
});
return children.map(ChildElement => React.cloneElement(ChildElement, { containerStyle: this.payload.style }));
}
internalRenderer() {
const payload = this.payload;
var columnSetContent = (
<ContainerWrapper configManager={this.props.configManager} style={{ flex: this.payload.columns.length }} json={payload} containerStyle={this.props.containerStyle}>
<ElementWrapper configManager={this.props.configManager} json={payload} style={styles.defaultBGStyle} isFirst={this.props.isFirst}>
{this.parsePayload()}
</ElementWrapper>
</ContainerWrapper>
);
if ((payload.selectAction === undefined) || !this.hostConfig.supportsInteractivity) {
return columnSetContent;
} else {
return <SelectAction configManager={this.props.configManager} selectActionData={payload.selectAction}>
{columnSetContent}
</SelectAction>;
}
}
render() {
let containerRender = this.internalRenderer();
return containerRender;
}
};
const styles = StyleSheet.create({
defaultBGStyle: {
backgroundColor: Constants.TransparentString,
flexDirection: Constants.FlexRow,
},
});

Просмотреть файл

@ -1,130 +0,0 @@
/**
* ContainerWrapper component that wraps the container type element
* and takes care of common container related parsing & styling.
*
* @example
* <ContainerWrapper json={payload}>
* <Column json={payload}></Column>
* </ContainerWrapper>
*/
import React from 'react';
import { View } from 'react-native';
import * as Utils from '../../utils/util';
import * as Enums from '../../utils/enums';
import * as Constants from "../../utils/constants";
import { BackgroundImage } from '../elements';
export class ContainerWrapper extends React.PureComponent {
constructor(props) {
super(props);
this.payload = props.json;
}
render() {
const receivedStyles = this.props.style;
const computedStyles = this.getComputedStyles();
return (
Utils.isNullOrEmpty(this.payload.altText) ?
<View style={[computedStyles, receivedStyles]}>
{!Utils.isNullOrEmpty(this.payload.backgroundImage) ? this.getBackgroundImageContainer() : this.props.children}
</View> :
<View
accessible={true}
accessibilityLabel={this.payload.altText}
style={[computedStyles, receivedStyles]}>
{!Utils.isNullOrEmpty(this.payload.backgroundImage) ? this.getBackgroundImageContainer() : this.props.children}
</View>
);
}
/**
* @description The method will return the container with a background Image.
*/
getBackgroundImageContainer = () => {
if (Utils.isString(this.payload.backgroundImage)) {
this.payload.backgroundImage = {
url: this.payload.backgroundImage
}
}
return (
<React.Fragment>
<BackgroundImage backgroundImage={this.payload.backgroundImage} />
{this.props.children}
</React.Fragment >
);
}
/**
* @description Determine the styles applicable based on the given payload
* @returns {object} - Styles computed based on the payload
*/
getComputedStyles = () => {
let computedStyles = [];
const { hostConfig } = this.props.configManager;
// vertical content alignment
let verticalContentAlignment = Utils.parseHostConfigEnum(
Enums.VerticalAlignment,
this.payload["verticalContentAlignment"],
Enums.VerticalAlignment.Top
);
switch (verticalContentAlignment) {
case Enums.VerticalAlignment.Center:
computedStyles.push({ justifyContent: Constants.CenterString });
break;
case Enums.VerticalAlignment.Bottom:
computedStyles.push({ justifyContent: Constants.FlexEnd });
break;
default:
computedStyles.push({ justifyContent: Constants.FlexStart });
break;
}
computedStyles.push({ backgroundColor: Constants.TransparentString });
// container BG style
let backgroundStyle;
const styleDefinition = hostConfig.containerStyles.getStyleByName(this.payload["style"], hostConfig.containerStyles.getStyleByName("default"));
//we won't apply the background color for the container which has backgroundImage. Even we won't apply color if its parent container having backgroundImage
const hasBackgroundImage = !Utils.isNullOrEmpty(this.payload.backgroundImage) || (this.payload.parent && !Utils.isNullOrEmpty(this.payload.parent.backgroundImage)) || (!Utils.isNullOrEmpty(this.props.hasBackgroundImage))
if (!hasBackgroundImage && !Utils.isNullOrEmpty(styleDefinition.backgroundColor)) {
backgroundStyle = { backgroundColor: this.payload["style"] !== undefined ? Utils.hexToRGB(styleDefinition.backgroundColor) : "transparent" };
}
computedStyles.push(backgroundStyle);
// border
const borderThickness = styleDefinition.borderThickness || 0;
const borderColor = styleDefinition.borderColor;
computedStyles.push({ borderWidth: borderThickness, borderColor: Utils.hexToRGB(borderColor) });
// padding
const padding = hostConfig.getEffectiveSpacing(Enums.Spacing.Padding);
computedStyles.push({ padding: padding });
// bleed
if (this.payload.bleed && this.props.containerStyle) {
const { isFirst, isLast } = this.props;
const marginLeft = isFirst ? -padding : 0;
const marginRight = isLast ? -padding : 0;
computedStyles.push({ marginVertical: -padding, marginLeft, marginRight });
}
// height
const payloadHeight = this.payload.height || false;
if (payloadHeight) {
const heightEnumValue = Utils.parseHostConfigEnum(
Enums.Height,
this.payload.height,
Enums.Height.Auto);
const height = hostConfig.getEffectiveHeight(heightEnumValue);
computedStyles.push({ flex: height });
!this.payload["verticalContentAlignment"] && height && computedStyles.push({ justifyContent: Constants.SpaceBetween })
}
return computedStyles;
}
}

Просмотреть файл

@ -1,134 +0,0 @@
/**
* Container Component.
*
* Refer https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema#schema-container
*/
import React from 'react';
import {
StyleSheet,
View,
Text
} from 'react-native';
import { Registry } from '../registration/registry';
import { SelectAction } from '../actions';
import * as Constants from '../../utils/constants';
import * as Utils from '../../utils/util';
import * as Enums from '../../utils/enums';
import { InputContext } from '../../utils/context';
import { ContainerWrapper } from './';
export class Container extends React.Component {
static contextType = InputContext;
constructor(props) {
super(props);
this.payload = props.json;
this.selectionActionData = props.json.selectAction;
this.hostConfig = props.configManager.hostConfig;
this.styleConfig = props.configManager.styleConfig;
}
/**
* @description Parse the given payload and render the card accordingly
* @returns {object} Return the child elements of the container
*/
parsePayload = () => {
let children = [];
if (!this.payload) {
return children;
}
if (this.payload.isFallbackActivated) {
if (this.payload.fallbackType == "drop") {
return null;
} else if (!Utils.isNullOrEmpty(element.fallback)) {
return Registry.getManager().parseComponent(this.payload.fallback, this.context.onParseError);
}
}
children = Registry.getManager().parseRegistryComponents(this.payload.items, this.context.onParseError);
return children.map((ChildElement, index) => React.cloneElement(ChildElement, {
containerStyle: this.payload.style,
isFirst: index === 0, configManager: this.props.configManager
}));
}
internalRenderer = () => {
const payload = this.payload;
const minHeight = Utils.convertStringToNumber(payload.minHeight);
//We will pass the style as array, since it can be updated in the container wrapper if required.
const containerStyle = typeof minHeight === "number" ? [{ minHeight }] : [];
const showValidationText = this.props.isError && this.context.showErrors;
var containerContent = (
<ContainerWrapper configManager={this.props.configManager} json={payload} style={containerStyle} containerStyle={this.props.containerStyle}>
{(payload.spacing || payload.separator) && this.getSpacingElement()}
{this.parsePayload()}
{showValidationText && this.getValidationText()}
</ContainerWrapper>
);
if ((payload.selectAction === undefined)
|| (!this.hostConfig.supportsInteractivity)) {
return containerContent;
} else {
return <SelectAction configManager={this.props.configManager} selectActionData={payload.selectAction}>
{containerContent}
</SelectAction>;
}
}
/**
* @description Return the element for spacing and/or separator
* @returns {object} View element with spacing based on `spacing` and `separator` prop
*/
getSpacingElement = () => {
const spacingEnumValue = Utils.parseHostConfigEnum(
Enums.Spacing,
this.payload.spacing,
Enums.Spacing.Default);
const spacing = this.hostConfig.getEffectiveSpacing(spacingEnumValue);
// separator and spacing styles
const separatorStyles = [{ height: spacing }];
const { isFirst } = this.props; //isFirst represent, it is first element
// separator styles
this.payload.separator && !isFirst && separatorStyles.push(this.styleConfig.separatorStyle);
// spacing styles
this.payload.spacing && separatorStyles.push({ paddingTop: spacing / 2, marginTop: spacing / 2, height: 0 });
return <View style={separatorStyles}></View>
}
/**
* @description Return the validation text message
* @returns {object} Text element with the message
*/
getValidationText = () => {
const payload = this.payload;
const validationTextStyles = [this.styleConfig.fontFamilyName, this.styleConfig.defaultDestructiveButtonForegroundColor];
const errorMessage = (payload.validation && payload.validation.errorMessage) ?
payload.validation.errorMessage : Constants.ErrorMessage;
return (
<Text style={validationTextStyles}>
{errorMessage}
</Text>
)
}
render() {
let containerRender = this.internalRenderer();
return containerRender;
}
};
const styles = StyleSheet.create({
defaultBGStyle: {
backgroundColor: Constants.TransparentString,
},
});

Просмотреть файл

@ -1,17 +0,0 @@
import React from 'react';
import {
TouchableWithoutFeedback,
Keyboard,
View
} from 'react-native';
const DismissKeyboardHOC = (Comp) => {
return ({ children, ...props }) => (
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<Comp {...props}>
{children}
</Comp>
</TouchableWithoutFeedback>
);
};
export const DismissKeyboardView = DismissKeyboardHOC(View)

Просмотреть файл

@ -1,157 +0,0 @@
/**
* FactSet Component.
*
* Refer https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema#schema-factset
*/
import React from 'react';
import {
View,
StyleSheet,
} from 'react-native';
import ElementWrapper from '../elements/element-wrapper';
import * as Constants from '../../utils/constants';
import * as Utils from '../../utils/util';
import { Label } from '../elements';
export class FactSet extends React.Component {
constructor(props) {
super(props);
this.hostConfig = props.configManager.hostConfig;
this.payload = props.json;
// state
this.state = {
isMaximumWidthValueFound: false,
keyWidth: '50%',
valueWidth: '50%'
}
this.viewSize = 0;
this.maxWidth = 0;
this.widthArray = [];
this.currentWidth = 0;
}
/**
* @description Measures the view size for Factset
*/
measureView(event) {
if (this.currentWidth === 0 || this.currentWidth !== event.nativeEvent.layout.width) {
this.currentWidth = event.nativeEvent.layout.width;
this.viewSize = event.nativeEvent.layout.width;
this.getFactSetWidthFromHostConfig();
}
}
/**
* @description Finds the width for Fact key and column value
*/
getFactSetWidthFromHostConfig() {
let titleConfig = this.hostConfig.factSet.title;
let valueConfig = this.hostConfig.factSet.value;
if (!Utils.isNullOrEmpty(titleConfig.maxWidth) && (titleConfig.maxWidth !== 0) && Utils.isaNumber(titleConfig.maxWidth)) {
if (titleConfig.maxWidth < (0.8 * this.viewSize)) {
let currentValueWidth = this.viewSize - titleConfig.maxWidth;
this.setFactSetWidthSize(titleConfig.maxWidth, currentValueWidth);
} else {
let currentTitleWidth = 0.8 * this.viewSize;
let currentValueWidth = this.viewSize - currentTitleWidth;
this.setFactSetWidthSize(currentTitleWidth, currentValueWidth);
}
} else if (!Utils.isNullOrEmpty(valueConfig.maxWidth) && (valueConfig.maxWidth !== 0) && Utils.isaNumber(valueConfig.maxWidth)) {
if (valueConfig.maxWidth < (0.8 * this.viewSize)) {
let currentTitleWidth = this.viewSize - valueConfig.maxWidth;
this.setFactSetWidthSize(currentTitleWidth, valueConfig.maxWidth);
} else {
let currentValueWidth = 0.8 * this.viewSize;
let currentTitleWidth = this.viewSize - currentTitleWidth;
this.setFactSetWidthSize(currentTitleWidth, currentValueWidth);
}
} else {
this.setFactSetWidthSize('50%', '50%');
}
}
setFactSetWidthSize(titleWidth, valueWidth) {
this.setState({
keyWidth: titleWidth,
valueWidth: valueWidth
})
}
/**
* @description Renders the Fact key and column value after width values are calculated.
*/
parsePayload = (factSetJson) => {
renderedElement = [];
if (!this.payload)
return renderedElement;
// host config
let titleConfig = this.hostConfig.factSet.title;
let valueConfig = this.hostConfig.factSet.value;
factSetJson.facts.map((element, index) => {
renderedElement.push(
<View style={[styles.textContainer]} key={`FACT-${element.title}-${index}`}>
<Label
text={element.title}
size={titleConfig.size}
weight={titleConfig.weight}
color={titleConfig.color}
isSubtle={titleConfig.isSubtle}
wrap={titleConfig.wrap}
configManager={this.props.configManager}
style={{ width: this.state.keyWidth }} />
<Label
text={element.value}
size={valueConfig.size}
weight={valueConfig.weight}
color={valueConfig.color}
isSubtle={valueConfig.isSubtle}
wrap={valueConfig.wrap}
configManager={this.props.configManager}
style={[styles.valueTextStyle, { width: this.state.valueWidth }]} />
</View>
);
});
return renderedElement;
}
/**
* @description conditional render to check if width value is found
*/
internalRenderer(containerJson) {
let factSetObject = null;
factSetObject = this.parsePayload(containerJson)
return (
<ElementWrapper configManager={this.props.configManager} json={containerJson} isFirst={this.props.isFirst}>
<View style={[styles.container]} onLayout={(event) => { this.measureView(event) }}>
{factSetObject}
</View>
</ElementWrapper>
);
}
render() {
let factSetContainer = this.internalRenderer(this.props.json);
return factSetContainer;
}
};
const styles = StyleSheet.create({
container: {
flexDirection: Constants.FlexColumn,
backgroundColor: 'transparent',
},
textContainer: {
flexDirection: Constants.FlexRow,
backgroundColor: 'transparent',
},
valueTextStyle: {
paddingLeft: 5,
}
});

Просмотреть файл

@ -1,79 +0,0 @@
/**
* ImageSet Component.
*
* Refer https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/card-schema#schema-imageset
*/
import React from 'react';
import { StyleSheet } from 'react-native';
import { Registry } from '../registration/registry';
import ElementWrapper from '../elements/element-wrapper';
import { InputContextConsumer } from '../../utils/context';
import * as Constants from '../../utils/constants';
import * as Enums from '../../utils/enums';
const FlexWrap = 'wrap';
const SizeKey = "size";
const ImageSetKey = "fromImageSet";
export class ImageSet extends React.PureComponent {
constructor(props) {
super(props);
this.payload = props.json;
}
/**
* @description Parse the given payload and render the card accordingly
*/
parsePayload = (imageSetJson, onParseError) => {
const renderedElement = [];
if (!this.payload)
return renderedElement;
const register = Registry.getManager();
// parse elements
// This function is repetitive across containers. Needs to be made Generic.
imageSetJson.images.map((element, index) => {
element[SizeKey] = this.payload.imageSize;
element[ImageSetKey] = true;
const Element = register.getComponentOfType(element.type);
if (Element) {
renderedElement.push(<Element json={element} configManager={this.props.configManager}
key={`ELEMENT-${index}`} isFirst={index == 0} />);
} else {
let error = { "error": Enums.ValidationError.UnknownElementType, "message": `Unknown Type ${element.type} encountered` };
onParseError(error);
return null;
}
});
return renderedElement;
}
internalRenderer(imageSetJson) {
return (
(<InputContextConsumer>
{({ onParseError }) => <ElementWrapper configManager={this.props.configManager} json={imageSetJson} style={[styles.container, styles.defaultBGStyle]} isFirst={this.props.isFirst}>
{this.parsePayload(imageSetJson, onParseError)}
</ElementWrapper>}
</InputContextConsumer>)
);
}
render() {
let containerRender = this.internalRenderer(this.props.json);
return containerRender;
}
}
const styles = StyleSheet.create({
container: {
flexDirection: Constants.FlexRow,
flexWrap: FlexWrap,
},
defaultBGStyle: {
backgroundColor: Constants.TransparentString,
},
});

Просмотреть файл

@ -1,7 +0,0 @@
export * from './container-wrapper';
export * from './column';
export * from './columnset';
export * from './container';
export * from './factset';
export * from './image-set';
export * from './dismiss-keyboard';

Просмотреть файл

@ -1,198 +0,0 @@
/**
* BackgroungImage Element.
*
* Refer https://github.com/Microsoft/AdaptiveCards/issues/2032
*/
import React from "react";
import {
View,
StyleSheet,
Image
} from "react-native";
import * as Constants from "../../utils/constants";
import * as Enums from '../../utils/enums';
import * as Utils from '../../utils/util';
import PropTypes from 'prop-types';
import { InputContextConsumer } from '../../utils/context';
export class BackgroundImage extends React.Component {
constructor(props) {
super(props);
this.backgroundImage = props.backgroundImage;
this.parseHostConfig();
this.backgroundImage.url = Utils.getImageUrl(this.backgroundImage.url)
this.state = {
backgroundImageHeight: 0,
backgroundImageWidth: 0
}
}
componentDidMount() {
Image.getSize(this.backgroundImage.url, (backgroundImageWidth, backgroundImageHeight) => {
this.setState({ backgroundImageWidth, backgroundImageHeight })
});
}
/**
* @description Parse hostconfig specific to this element
*/
parseHostConfig = () => {
this.backgroundImageModeEnumValue = Utils.parseHostConfigEnum(
Enums.BackgroundImageMode,
this.backgroundImage.fillMode || this.backgroundImage.mode,
Constants.AlignStretch);
this.verticalAlignmentEnumValue = Utils.parseHostConfigEnum(
Enums.VerticalAlignment,
this.backgroundImage.verticalAlignment,
Constants.Top);
this.horizontalAlignmentEnumValue = Utils.parseHostConfigEnum(
Enums.HorizontalAlignment,
this.backgroundImage.horizontalAlignment,
Constants.LeftAlign);
}
/**
* @description
* This function is to handle the error occurred loading the image
*
*/
onError = (onParseError) => {
let error = { "error": Enums.ValidationError.InvalidPropertyValue, "message": `Not able to load the image` };
onParseError(error);
}
/**
* @description
* This function will return the vertical alignment of the image
*
*/
getImageVerticalAlignment = () => {
switch (this.verticalAlignmentEnumValue) {
case Enums.VerticalAlignment.Bottom:
return { justifyContent: Constants.FlexEnd }
case Enums.VerticalAlignment.Center:
return { justifyContent: Constants.CenterString }
case Enums.VerticalAlignment.Top:
default:
return { justifyContent: Constants.FlexStart }
}
}
/**
* @description
* This function will return the horizontal alignment of the image
*
*/
getImageHorizontalAlignment = () => {
switch (this.horizontalAlignmentEnumValue) {
case Enums.HorizontalAlignment.Right:
return { alignItems: Constants.FlexEnd }
case Enums.HorizontalAlignment.Center:
return { alignItems: Constants.CenterString }
case Enums.HorizontalAlignment.Left:
default:
return { alignItems: Constants.FlexStart }
}
}
/**
* @description
* This function will return the background image based on the mode.
*
*/
getBackgroundImage = (onParseError) => {
let imageContainerStyle = [];
let backgroundImage = [];
imageContainerStyle.push(styles.imageContainer)
switch (this.backgroundImageModeEnumValue) {
case Enums.BackgroundImageMode.Repeat:
imageContainerStyle.push({ alignItems: Constants.FlexStart, justifyContent: Constants.FlexStart });
backgroundImage.push(
<Image
key="image-repeat"
resizeMethod={Constants.Resize}
accessible={true}
accessibilityLabel={this.backgroundImage.altText}
source={{ uri: this.backgroundImage.url }}
onError={() => { this.onError(onParseError) }}
style={{ width: Constants.FullWidth, height: Constants.FullWidth, resizeMode: Constants.Repeat }}
/>
);
break;
case Enums.BackgroundImageMode.RepeatHorizontally:
imageContainerStyle.push(this.getImageVerticalAlignment());
backgroundImage.push(
<Image
key="image-repeat-horizontal"
resizeMethod={Constants.Resize}
accessible={true}
accessibilityLabel={this.backgroundImage.altText}
source={{ uri: this.backgroundImage.url }}
onError={() => { this.onError(onParseError) }}
/**
* when the resize mode for the image is "repeat". it's always taking the row count as 3. So, we have divided the image height by 3.
* Refer https://github.com/facebook/react-native/issues/17684
*/
style={{ width: Constants.FullWidth, height: this.state.backgroundImageHeight / 3, resizeMode: Constants.Repeat }}
/>
);
break;
case Enums.BackgroundImageMode.RepeatVertically:
imageContainerStyle.push(this.getImageHorizontalAlignment());
backgroundImage.push(
<Image
key="image-repeat-vertical"
resizeMethod={Constants.Resize}
accessible={true}
accessibilityLabel={this.backgroundImage.altText}
source={{ uri: this.backgroundImage.url }}
onError={() => { this.onError(onParseError) }}
style={{ width: this.state.backgroundImageWidth / 3, height: Constants.FullWidth, resizeMode: Constants.Repeat }}
/>
);
break;
case Enums.BackgroundImageMode.Stretch:
case Enums.BackgroundImageMode.Cover:
default:
backgroundImage.push(
<Image
key="image-stretch"
source={{ uri: this.backgroundImage.url }}
accessible={true}
accessibilityLabel={this.backgroundImage.altText}
onError={() => { this.onError(onParseError) }}
style={{ width: Constants.FullWidth, height: Constants.FullWidth, resizeMode: Constants.AlignStretch }}
/>
);
break;
}
return (
< View style={imageContainerStyle} >
{backgroundImage}
</View >
);
}
render() {
return (
<InputContextConsumer>
{({ onParseError }) => (this.getBackgroundImage(onParseError))}
</InputContextConsumer>
);
}
}
BackgroundImage.propTypes = {
backgroundImage: PropTypes.object.isRequired
};
const styles = StyleSheet.create({
imageContainer: {
position: Constants.Absolute,
width: Constants.FullWidth,
height: Constants.FullWidth
}
});

Просмотреть файл

@ -1,129 +0,0 @@
/**
* ElementWrapper component that wraps all other element types and
* takes care of common parsing & styling.
*
* @example
* <ElementWrapper json={payload}>
* <InputElement json={payload}></InputElement>
* </ElementWrapper>
*/
import React from 'react';
import {
View,
Text,
StyleSheet
} from 'react-native';
import PropTypes from 'prop-types';
import { InputContext } from '../../utils/context';
import * as Constants from '../../utils/constants';
import * as Utils from '../../utils/util';
import * as Enums from '../../utils/enums';
export default class ElementWrapper extends React.Component {
static contextType = InputContext;
static propTypes = {
isFirst: PropTypes.bool
};
static defaultProps = {
isFirst: false
};
render() {
this.styleConfig = this.props.configManager.styleConfig;
const computedStyles = this.getComputedStyles();
const showValidationText = this.props.isError && this.context.showErrors && Utils.isNullOrEmpty(this.props.json.inlineAction);
const { isFirst } = this.props; //isFirst represent, it is first element
const isColumnSet = this.props.json.type === Constants.TypeColumnSet;
return (
<React.Fragment>
{!isColumnSet ? !isFirst && this.getSpacingElement() : this.props.json.separator && !isFirst && this.getSeparatorElement()}
<View style={computedStyles} onLayout={this.props.onPageLayout}>
{this.props.children}
{showValidationText && this.getValidationText()}
</View>
</React.Fragment>
)
}
/**
* @description Return the styles applicable based on the given payload
* @returns {Array} computedStyles
*/
getComputedStyles = () => {
const payload = this.props.json;
const receivedStyles = this.props.style;
let computedStyles = [styles.inputContainer, receivedStyles];
// height
const height = payload.height || false;
if (height) {
const heightEnumValue = Utils.parseHostConfigEnum(
Enums.Height,
payload.height,
Enums.Height.Auto);
const height = this.props.configManager.hostConfig.getEffectiveHeight(heightEnumValue);
computedStyles.push({ flex: height });
}
return computedStyles;
}
/**
* @description Return the validation text message
* @returns {object} Text element with the message
*/
getValidationText = () => {
const payload = this.props.json;
const validationTextStyles = [this.styleConfig.fontFamilyName, this.styleConfig.defaultDestructiveButtonForegroundColor];
return (
<Text style={validationTextStyles}>
{payload.errorMessage || Constants.ErrorMessage}
</Text>
)
}
/**
     * @description Return the element for spacing and/or separator
     * @returns {object} View element with spacing based on `spacing` and `separator` prop
     */
getSpacingElement = () => {
const payload = this.props.json;
const spacingEnumValue = Utils.parseHostConfigEnum(
Enums.Spacing,
payload.spacing,
Enums.Spacing.Default);
const spacing = this.props.configManager.hostConfig.getEffectiveSpacing(spacingEnumValue);
const separator = payload.separator || false;
// spacing styles
const separatorStyles = [{ height: spacing }];
// separator styles
if (separator) {
separatorStyles.push(this.styleConfig.separatorStyle);
separatorStyles.push({ paddingTop: spacing / 2, marginTop: spacing / 2, height: 0 });
}
return <View style={separatorStyles}></View>
}
/**
     * @description Return the element for separator
     * @returns {object} View element with `separator` prop
     */
getSeparatorElement = () => {
return <View style={[this.styleConfig.separatorStyle, { height: 3 }]}></View>
}
}
const styles = StyleSheet.create({
inputContainer: {
backgroundColor: Constants.TransparentString
}
})

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше